summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/glformats.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Add the format enums for BPTC-compressed imagesNeil Roberts2014-08-121-0/+10
| | | | | | | | | | | | | | | | | | 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: Add utility function _mesa_is_enum_format_unorm()Anuj Phogat2014-08-041-0/+71
| | | | | | | | V2: Add missing formats. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Add a helper function _mesa_is_enum_format_unsized()Anuj Phogat2014-08-041-0/+56
| | | | | | | | | | Function is utilized by next patch in the series. V2: Add missing formats. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Add utility function _mesa_is_enum_format_snorm()Anuj Phogat2014-08-041-0/+37
| | | | | | Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* Remove the ATI_envmap_bumpmap extensionJason Ekstrand2014-06-301-35/+0
| | | | | | | | | | | As far as I can tell, the Intel mesa driver is the only driver in the world still supporting this legacy extension. If someone wants to do bump mapping, they can use shaders. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> [v1] Reviewed-by: Chris Forbes <[email protected]> [v2] Reviewed-by: Ian Romanick <[email protected]> [v3]
* Remove _mesa_is_type_integer and _mesa_is_enum_format_or_type_integerNeil Roberts2014-06-131-30/+0
| | | | | | | | | | | | | | | | | | | | | | | The comment for _mesa_is_type_integer is confusing because it says that it returns whether the type is an “integer (non-normalized)” format. I don't think it makes sense to say whether a type is normalized or not because it depends on what format it is used with. For example, GL_RGBA+GL_UNSIGNED_BYTE is normalized but GL_RGBA_INTEGER+GL_UNSIGNED_BYTE isn't. If the normalized comment is just a mistake then it still doesn't make much sense because it is missing the packed-pixel types such as GL_UNSIGNED_INT_5_6_5. If those were added then it effectively just returns type != GL_FLOAT. That function was only used in _mesa_is_enum_format_or_type_integer. This function effectively checks whether the format is non-normalized or the type is an integer. I can't think of any situation where that check would make sense. As far as I can tell neither of these functions have ever been used anywhere so we should just remove them to avoid confusion. These functions were added in 9ad8f431b2a47060bf05517246ab0fa8d249c800. Reviewed-by: Brian Paul <[email protected]>
* mesa: Fix error code generation in glReadPixels()Anuj Phogat2014-04-211-0/+16
| | | | | | | | | | | | | | | | | | | | Section 4.3.1, page 220, of OpenGL 3.3 specification explains the error conditions for glreadPixels(): "If the format is DEPTH_STENCIL, then values are taken from both the depth buffer and the stencil buffer. If there is no depth buffer or if there is no stencil buffer, then the error INVALID_OPERATION occurs. If the type parameter is not UNSIGNED_INT_24_8 or FLOAT_32_UNSIGNED_INT_24_8_REV, then the error INVALID_ENUM occurs." Fixes failing Khronos CTS test packed_depth_stencil_error.test V2: Avoid code duplication Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: GL_ARB_half_float_pixel is not optionalIan Romanick2014-02-111-18/+6
| | | | | | | | | | | | | | | | | Almost every driver already supported it. All current and future Gallium drivers always support it, and most existing classic drivers support it. This only changes radeon and nouveau. This extension only adds data types that can be passed to, for example, glTexImage2D. It does not add internal formats. Since you can already pass GL_FLOAT to glTexImage2D this shouldn't pose any additional issues with those drivers. Note that r200 and i915 already supported this extension, and they don't support floating-point textures either. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: whitespace fixes in glformats.cBrian Paul2014-01-231-75/+51
| | | | | | | Reindent _mesa_get_nongeneric_internalformat() to match other functions. Remove extraneous empty lines in _mesa_get_linear_internalformat(). Trivial.
* mesa: fix/add some cases in _mesa_get_linear_internalformat()Brian Paul2014-01-231-1/+7
| | | | | | | | In some cases we were converting generic formats to sized formats and vice versa. The point is to simply convert sRGB formats to corresponding linear formats. Reviewed-by: Marek Olšák <[email protected]>
* mesa: Clean up bad code formatting left from previous commitIan Romanick2013-12-201-1/+1
| | | | | | | Also s/_EXT// on enums that are now part of core. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: GL_EXT_packed_depth_stencil is not optionalIan Romanick2013-12-201-5/+1
| | | | | | | | Every driver supports it. All current and future Gallium drivers always support it, and all existing classic drivers support it. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: minor simplification in _mesa_es3_error_check_format_and_type()Brian Paul2013-12-181-3/+1
| | | | The type_valid local was set to true and never changed.
* mesa: Add support to _mesa_bytes_per_vertex_attrib for 10_11_11 format.Chris Forbes2013-11-081-0/+5
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Eric Anholt <[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: Allow ETC2/EAC formats with ARB_ES3_compatibility.Matt Turner2013-03-081-1/+1
| | | | | | Fixes piglit's oes_compressed_etc2_texture-miptree tests on Desktop GL. Reported-by: Marek Olšák <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* Revert "mesa: Return INVALID_OPERATION when type is known but not allowed"Matt Turner2013-01-301-11/+1
| | | | | | | | | | | | This reverts commit 2906e2034c9d674601960a5b586b6e986e6ef04f. Fixes a regression in the glean depthStencil test. Reverting this does not affect any tests in es3conform, so a more recent patch must have also fixed the failure this one was intended to fix. Reported-by: lu hua <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59494
* mesa: Like EXT_texture_compression_dxt1, advertise ↵Ian Romanick2013-01-231-5/+3
| | | | | | | | | | | | | | | ANGLE_texture_compression_dxt in all APIs This is technically outside the ANGLE spec, but it seems unlikely to cause any harm. v2: Simplify the extension checks by assuming the ANGLE extension will always be enabled by any driver that enables the EXT. Suggested by Eric Anholt. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Lee Salzman <[email protected]>
* mesa: Use a single flag for the S3TC extensions that don't require on-line ↵Ian Romanick2013-01-231-1/+2
| | | | | | | | compression Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Lee Salzman <[email protected]>
* mesa/es3: Allow unsized depth and depth-stencil formats in ES3Ian Romanick2013-01-201-2/+5
| | | | | | | | | They're part of GL_OES_depth_texture_cube_map, and we'll always enable that extension in ES3 contexts. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa/es3: Don't check dimensions in _mesa_es3_error_check_format_and_typeIan Romanick2013-01-171-8/+1
| | | | | | | | | | Filtering of DEPTH_COMPONENT and DEPTH_STENCIL for TEXTURE_3D is already done in texture_error_check because these combinations aren't allowed on desktop GL either. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* mesa: Return INVALID_OPERATION when type is known but not allowedMatt Turner2013-01-151-1/+11
| | | | | | | | INVALID_ENUM is for when the type is simply not known. Fixes part of es3conform's packed_depth_stencil_error test. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glformats: allow GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV for GLES2/3Jordan Justen2013-01-141-0/+8
| | | | | | | | This format is allowed by the GL_EXT_texture_type_2_10_10_10_REV extension. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glformats: add _mesa_es3_error_check_format_and_typeMatt Turner2013-01-141-0/+439
| | | | | | | | | This function checks for ES3 compatible format/type/internalFormat/dimension combinations. [[email protected]: additional tweaks for gles3-gtf] Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glformats: support _mesa_bytes_per_pixel for 2101010+GL_RGBJordan Justen2013-01-121-1/+2
| | | | | Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glformats: add _mesa_base_format_component_countJordan Justen2013-01-121-0/+26
| | | | | Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glformats: add functions to detect signed/unsigned integer typesJordan Justen2013-01-121-14/+40
| | | | | Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Fix computation of default vertex attrib stride for 2_10_10_10 formats.Paul Berry2012-12-131-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if the client program didn't specify a stride when setting up a vertex attribute, we used _mesa_sizeof_type() to compute the size of the type, and multiplied it by the number of components. This didn't work for the 2_10_10_10 formats, since _mesa_sizeof_type() returns -1 for those types, resulting in all kinds of havoc, since it was causing the hardware to be programmed with a negative stride value. This patch adds a new function _mesa_bytes_per_vertex_attrib(), which is similar to the existing function _mesa_bytes_per_pixel(), but which computes the size of a vertex attribute based on the type and the number of formats. For packed formats (currently only the 2_10_10_10 formats), it verifies that the number of components is correct and returns the size of the packed format. For unpacked formats, it returns the size of the type times the number of components. In addition, this patch adds an assertion so that if we ever forget to update _mesa_bytes_per_vertex_attrib() when adding a new vertex format, we'll see the problem quickly rather than having to debug a subtle conformance test failure. Fixes GLES3 conformance tests vertex_type_2_10_10_10_rev_{conversion,divisor,stride_pointer}.test. Reviewed-by: Brian Paul <[email protected]>
* mesa: Add new MESA_FORMATs for ETC2 compressed texturesAnuj Phogat2012-12-071-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Rename API_OPENGL to API_OPENGL_COMPAT.Paul Berry2012-11-291-2/+2
| | | | | | | | | | This should help avoid confusion now that we're using the gl_api enum to distinguishing between core and compatibility API's. The corresponding enum value for core API's is API_OPENGL_CORE. Acked-by: Eric Anholt <[email protected]> Acked-by: Matt Turner <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* mesa: move some helper functions from fboobject.c to glformats.cMarek Olšák2012-11-291-0/+113
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: remove FEATURE_ES test in _mesa_is_compressed_format()Brian Paul2012-10-161-2/+0
| | | | | | The code already has a runtime ES1 test. Reviewed-by: Ian Romanick <[email protected]>
* intel: add support for ANGLE_texture_compression_dxt.Oliver McFadden2012-10-011-2/+4
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: move _mesa_es_error_check_format_and_type() to glformats.cBrian Paul2012-09-261-0/+69
| | | | | | Where the non-ES _mesa_error_check_format_and_type() function lives. Reviewed-by: Kenneth Graunke <[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: add generic compressed -> uncompressed format helperBrian Paul2012-08-241-0/+39
| | | | | | | _mesa_generic_compressed_format_to_uncompressed_format() probably wins the prize for longest function name in Mesa. Reviewed-by: Anuj Phogat <[email protected]>
* mesa/es: Validate glCompressedTexImage internalFormat in Mesa code rather ↵Ian Romanick2012-08-231-8/+16
| | | | | | | | | | than the ES wrapper v2: Add proper core-profile filtering. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa: Replace VersionMajor/VersionMinor with a Version field.Eric Anholt2012-08-071-4/+4
| | | | | | | | | | | As we get into supporting GL 3.x core, we come across more and more features of the API that depend on the version number as opposed to just the extension list. This will let us more sanely do version checks than "(VersionMajor == 3 && VersionMinor >= 2) || VersionMajor >= 4". v2: Fix a bad <= 30 check. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: move _mesa_error_check_format_and_type() to glformats.cBrian Paul2012-07-241-0/+367
| | | | | Now all the format/type-related helper functions are in glformats.c and image.c is just image-related functions.
* mesa: move more format helper functions to glformats.cBrian Paul2012-07-241-0/+365
|
* mesa: move some format helper functions to glformats.cBrian Paul2012-07-241-1/+397
|
* mesa: add glformats integer type/format detection routinesJordan Justen2012-07-211-0/+201
_mesa_is_integer_format is moved to formats.c and renamed as _mesa_is_enum_format_integer. _mesa_is_format_unsigned, _mesa_is_type_integer, _mesa_is_type_unsigned, and _mesa_is_enum_format_or_type_integer are added. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]>