summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-01-13main: round floating-point value to nearest integer in glGetTexParameteriv()Samuel Iglesias Gonsalvez1-5/+12
Previously, a cast was done to convert from float to int but there were rounding errors. The spec specificies in Data Conversion chapter that Floating-point values are rounded to the nearest integer. This patch fixes the following 8 dEQP tests: dEQP-GLES3.functional.state_query.texture.texture_2d_texture_min_lod_gettexparameteri dEQP-GLES3.functional.state_query.texture.texture_2d_texture_max_lod_gettexparameteri dEQP-GLES3.functional.state_query.texture.texture_3d_texture_min_lod_gettexparameteri dEQP-GLES3.functional.state_query.texture.texture_3d_texture_max_lod_gettexparameteri dEQP-GLES3.functional.state_query.texture.texture_2d_array_texture_min_lod_gettexparameteri dEQP-GLES3.functional.state_query.texture.texture_2d_array_texture_max_lod_gettexparameteri dEQP-GLES3.functional.state_query.texture.texture_cube_map_texture_min_lod_gettexparameteri dEQP-GLES3.functional.state_query.texture.texture_cube_map_texture_max_lod_gettexparameteri Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-01-13main: fix return GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL valueSamuel Iglesias Gonsalvez1-1/+2
Return the proper value for two-dimensional array texture and three-dimensional textures. From OpenGL ES 3.0 spec, chapter 6.1.13 "Framebuffer Object Queries", page 234: "If pname is FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER and the texture object named FRAMEBUFFER_ATTACHMENT_OBJECT_NAME is a layer of a three-dimensional texture or a two-dimensional array texture, then params will contain the number of the texture layer which contains the attached im- age. Otherwise params will contain the value zero." Furthermore, FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER is an alias of FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT. This patch fixes dEQP test: dEQP-GLES3.functional.state_query.fbo.framebuffer_attachment_texture_layer Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-01-13i965: Fix bitcast operations with negate (ceil)Iago Toral Quiroga2-8/+14
Commit 0ae9ca12a8 put source modifiers out of the bitcast operations by adding a MOV operation that would handle them separately. It missed the case of ceil though: the implementation negates both its source and destination operands. The source operand will be used for RNDD, which we can handle normally, but we need to fix the modifier for the negated result. v2: - RNDD can handle the source modifier so no need to put that one in a separate MOV. Fixes the following 42 dEQP tests: dEQP-GLES3.functional.shaders.builtin_functions.common.ceil.*_vertex dEQP-GLES3.functional.shaders.builtin_functions.common.ceil.*_fragment dEQP-GLES3.functional.shaders.builtin_functions.precision.ceil._*vertex.* dEQP-GLES3.functional.shaders.builtin_functions.precision.ceil._*fragment.* Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-13mesa: Depth and stencil attachments must be the same in OpenGL ES3Iago Toral Quiroga1-0/+20
"9.4. FRAMEBUFFER COMPLETENESS ... Depth and stencil attachments, if present, are the same image." Notice that this restriction is not included in the OpenGL ES2 spec. Fixes 18 dEQP tests in: dEQP-GLES3.functional.fbo.completeness.attachment_combinations.* Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-01-13mesa: Initializes the stencil value masks to 0xFF instead of ~0uEduardo Lima Mitev1-6/+18
'4.1.4 Stencil Test' section of the GL-ES 3.0 specification says: "In the initial state, [...] the front and back stencil mask are both set to the value 2^s − 1, where s is greater than or equal to the number of bits in the deepest stencil buffer* supported by the GL implementation." Since the maximum supported precision for stencil buffers is 8 bits, mask values should be initialized to 2^8 - 1 = 0xFF. Currently, these masks are initialized to max unsigned integer (~0u), because in OpenGL 3.0 and before, the initial mask values were: "In the initial state, stenciling is disabled, the front and back stencil reference value are both zero, the front and back stencil comparison functions are both ALWAYS, and the front and back stencil mask are both all ones." The problem is that it causes the mask values to overflow to -1 when converted to signed integer by glGet* APIs. Fixes 6 dEQP failing tests: * dEQP-GLES3.functional.state_query.integers.stencil_value_mask_getfloat * dEQP-GLES3.functional.state_query.integers.stencil_back_value_mask_getfloat * dEQP-GLES3.functional.state_query.integers.stencil_value_mask_separate_getfloat * dEQP-GLES3.functional.state_query.integers.stencil_value_mask_separate_both_getfloat * dEQP-GLES3.functional.state_query.integers.stencil_back_value_mask_separate_getfloat * dEQP-GLES3.functional.state_query.integers.stencil_back_value_mask_separate_both_getfloat Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-01-13i965: Sets missing vertex shader constant values for HighInt formatEduardo Lima Mitev1-0/+6
The range's min and max, and the precision value are not set correctly for the vertex shader constants. Fixes 1 dEQP test: dEQP-GLES3.functional.state_query.shader.precision_vertex_highp_int Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-01-12r600g: fix build failure when building the driver without LLVMMarek Olšák1-0/+4
2015-01-12main: Remove comparison unsigned int >= 0.Laura Ekstrand1-1/+0
Fixes "macro compares unsigned to 0 (NO_EFFECT)" found by Coverity Scan. Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-01-12mesa/main: In _mesa_CompressedTextureSubImage3D() check found texObjJuha-Pekka Heikkila1-0/+2
Check returned texObj is not null. If texObj is null there is already GL_INVALID_OPERATION error set. Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
2015-01-12mesa: Move declarations to to of block.José Fonseca1-3/+3
To fix MSVC build. Trivial.
2015-01-12mesa: restrict use of GL_ABGR_EXT format to allowed data typesSamuel Iglesias Gonsalvez5-56/+46
GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_10_10_10_2, GL_UNSIGNED_INT_2_10_10_10_REV data types are not explicitly allowed to work with GL_ABGR_EXT format neither in GL nor GL_EXT_abgr specs. Removed the corresponding mesa formats as there are no other functions using them inside Mesa anymore. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Remove _mesa_rebase_rgba_uint and _mesa_rebase_rgba_floatIago Toral Quiroga2-133/+0
These are no longer used anywhere now that we have _mesa_format_convert. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Remove _mesa_pack_int_rgba_row() and auxiliary functionsSamuel Iglesias Gonsalvez2-89/+0
These are no longer used. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Remove _mesa_(un)pack_index_spanIago Toral Quiroga2-234/+0
These are not used anywhere. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Remove _mesa_pack_rgba_span_float and tmp_pack.hIago Toral Quiroga3-607/+0
_mesa_pack_rgba_span_float was the last of the color span functions and we have replaced all calls to it with calls to _mesa_format_convert, so we can remove it together with tmp_pack.h which was used to generate the pack functions for multiple types that were used from the various color span functions that have been removed. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Remove _mesa_unpack_color_span_floatIago Toral Quiroga2-1042/+0
And various helper functions that went unused after removing it. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Remove (signed) integer pack and span functions.Iago Toral Quiroga2-237/+0
These are no longer used now that we moved to _mesa_format_convert. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Remove _mesa_unpack_color_span_ubyteIago Toral Quiroga2-265/+0
This is no longer used anywhere after moving to _mesa_format_convert. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Remove _mesa_make_temp_float_imageIago Toral Quiroga4-167/+42
Now that we have _mesa_format_convert we don't need this. This was only used to create temporary RGBA float images in the process of storing some compressed formats. These can call _mesa_texstore with a RGBA/float dst to achieve the same goal. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Remove _mesa_make_temp_ubyte_imageIago Toral Quiroga6-202/+114
Now that we have _mesa_format_convert we don't need this. texstore_rgba will use the GL_COLOR_INDEX to RGBA conversion helpers instead and compressed formats that used _mesa_make_temp_ubyte_image to create an ubyte RGBA temporary image can call _mesa_texstore with a RGBA/ubyte dst to achieve the same goal. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Remove _mesa_unpack_color_span_uintIago Toral Quiroga2-652/+0
This is no longer used. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Replace _mesa_unpack_bitmap with _mesa_unpack_image()Eduardo Lima Mitev3-117/+6
_mesa_unpack_bitmap() was introduced by commit 02b801c to handle the case when data is stored in PBO by display lists, in the context of this bug: Incorrect pixels read back if draw bitmap texture through Display list https://bugs.freedesktop.org/show_bug.cgi?id=10370 Since _mesa_unpack_image() already handles the case of GL_BITMAP, this patch removes _mesa_unpack_bitmap() and makes affected calls go through _mesa_unapck_image() instead. The sample test attached to the original bug report passes with this change and there are no piglit regressions. Signed-off-by: Eduardo Lima Mitev <elima@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Let _mesa_swizzle_and_convert take array format types instead of GL typesIago Toral Quiroga2-131/+119
In the future we would like to have a format conversion library that is independent of GL so we can share it with Gallium. This is a step in that direction. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12st/mesa: Use _mesa_format_convert to implement st_GetTexImage.Iago Toral Quiroga1-4/+13
Instead of using _mesa_pack_rgba_span_float. This should allow us to remove that function in a later patch. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12swrast: Use _mesa_format_convert to implement draw_rgba_pixels.Iago Toral Quiroga1-4/+34
This is the only place that uses _mesa_unpack_color_span_float so after this we should be able to remove that function. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Use _mesa_format_convert to implement get_tex_rgba_compressed.Iago Toral Quiroga1-39/+34
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: use _mesa_format_convert to implement get_tex_rgba_uncompressed.Iago Toral Quiroga1-117/+133
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: use _mesa_format_convert to implement glReadPixels.Iago Toral Quiroga1-142/+184
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Use _mesa_format_convert to implement texstore_rgba.Iago Toral Quiroga1-613/+70
Notice that _mesa_format_convert does not handle byte-swapping scenarios, GL_COLOR_INDEX or MESA_FORMAT_YCBCR(_REV), so these must be handled separately. Also, remove all the code that goes unused after using _mesa_format_convert. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Add helpers to extract GL_COLOR_INDEX to RGBA float/ubyteIago Toral Quiroga2-0/+99
We only use _mesa_make_temp_ubyte_image in texstore.c to convert GL_COLOR_INDEX to RGBA, but this helper does more stuff than this. All uses of this helper can be replaced with calls to _mesa_format_convert except for this GL_COLOR_INDEX conversion. This patch extracts the GL_COLOR_INDEX to RGBA logic to a separate helper so we can use that instead from texstore.c. In future patches we will replace all remaining calls to _mesa_make_temp_ubyte_image in the repository (related to compressed formats) with calls to _mesa_format_convert so we can remove _mesa_make_temp_ubyte_image and related functions. v2: - Remove ‘for’ loop initial declaration. They are only allowed in C99 or C11 mode. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Add RGBA to Luminance conversion helpersIago Toral Quiroga2-0/+224
For glReadPixels with a Luminance destination format we compute luminance values from RGBA as L=R+G+B. This, however, requires ad-hoc implementation, since pack/unpack functions or _mesa_swizzle_and_convert won't do this (and thus, neither will _mesa_format_convert). This patch adds helpers to do this computation so they can be used to support conversion to luminance formats. The current implementation of glReadPixels does this computation as part of the span functions in pack.c (see _mesa_pack_rgba_span_float), that do this together with other things like type conversion, etc. We do not want to use these functions but use _mesa_format_convert instead (later patches will remove the color span functions), so we need to extract this functionality as helpers. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Add _mesa_swap2_copy and _mesa_swap4_copyIago Toral Quiroga2-10/+32
We have _mesa_swap{2,4} but these do in-place byte-swapping only. The new functions receive an extra parameter so we can swap bytes on a source input array and store the results in a (possibly different) destination array. This is useful to implement byte-swapping in pixel uploads, since in this case we need to swap bytes on the src data which is owned by the application so we can't do an in-place byte swap. v2: - Include compiler.h in image.h, which is necessary to build in MSCV as indicated by Brian Paul. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa/pack: use _mesa_format_from_format_and_type in _mesa_pack_rgba_span_from_*Samuel Iglesias Gonsalvez1-256/+26
We had previously added the needed mesa formats, so we can simplify the code further. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Add helper to convert a GL format and type to a mesa (array) format.Iago Toral Quiroga2-0/+279
v2 after review by Jason Ekstrand: - Move _mesa_format_from_format_and_type to glformats - Return a mesa_format for GL_UNSIGNED_INT_8_8_8_8(_REV) v3: - Adapted to the new implementation of mesa_array_format as a plain uint32_t bitfield. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Add a helper _mesa_compute_rgba2base2rgba_component_mappingIago Toral Quiroga2-0/+58
This will come in handy when callers of _mesa_format_convert need to compute the rebase swizzle parameter to use. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Add a rebase_swizzle parameter to _mesa_format_convertIago Toral Quiroga2-70/+171
The new parameter allows callers to provide a rebase swizzle that the function needs to use to match the requirements of the base internal format involved. This is necessary when the source or destination internal formats (depending on whether we are doing the conversion for a pixel download or a pixel upload respectively) do not match the base formats of the source or destination formats of the conversion. This can happen when the driver does not support the internal formats and uses a different format to store pixel data internally. For example, a texture upload from RGB to Luminance in a driver that does not support textures with a Luminance format may decide to store the Luminance data as RGBA. In this case we want to store the RGBA values as (R,R,R,1). Following the same example, when we download from that texture to RGBA we want to read (R,0,0,1). The rebase_swizzle parameter allows these transforms to happen. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Expose compute_component_mapping as _mesa_compute_component_mappingIago Toral Quiroga3-207/+209
This is necessary to handle conversions between array types where the driver does not support the dst format requested by the client and chooses a different format instead. We will need this in _mesa_format_convert, so move it to format_utils.c, prefix it with '_mesa_' and make it available to other files. v2: - Move _mesa_compute_component_mapping to glformats Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Add an implementation of a master convert function.Jason Ekstrand2-0/+418
v2 by Iago Toral <itoral@igalia.com>: - When testing if we can directly pack we should use the src format to check if we are packing from an RGBA format. The original code used the dst format for the ubyte case by mistake. - Fixed incorrect number of bits for dst, it was computed using the src format instead of the dst format. - If the dst format is an array format, check if it is signed. We were only checking this for the case where it was not an array format, but we need to know this in both scenarios. - Fixed incorrect swizzle transform for the cases where we convert between array formats. - Compute is_signed and bits only once and for the dst format. We were computing these for the src format too but they were overwritten by the dst values immediately after. - Be more careful when selecting the integer path. Specifically, check that both src and dst are integer types. Checking only one of them should suffice since OpenGL does not allow conversions between normalized and integer types, but putting extra care here makes sense and also makes the actual requirements for this path more clear. - The format argument for pack functions is the destination format we are packing to, not the source format (which has to be RGBA). - Expose RGBA8888_* to other files. These will come in handy when in need to test if a given array format is RGBA or in need to pass RGBA formats to mesa_format_convert. v3 by Samuel Iglesias <siglesias@igalia.com>: - Add an RGBA8888_INT definition. v4 by Iago Toral <itoral@igalia.com> after review by Jason Ekstrand: - Added documentation for _mesa_format_convert. - Added additional explanatory comments for integer conversions. - Ensure that we use _messa_swizzle_and_convert for all signed source formats. - Squashed: do not directly (un)pack to RGBA UINT if the source is not unsigned. v5 by Iago Toral <itoral@igalia.com>: - Adapted to the new implementation of mesa_array_format as a plain uint32_t bitfield. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa/pack: refactor _mesa_pack_rgba_span_float()Samuel Iglesias Gonsalvez2-1166/+153
Use autogenerated format pack functions and take advantage of some macros to reduce source code, facilitating its maintenance. Unfortunately, dstType == GL_UNSIGNED_SHORT cannot simplified like the others, so keep it as it is. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa/main/pack_tmp.h: Add float conversion supportSamuel Iglesias Gonsalvez1-1/+74
We will use this in a later patch to refactor _mesa_pack_rgba_span_float. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa/pack: use autogenerated format_pack functionsSamuel Iglesias Gonsalvez1-525/+138
Take advantage of new mesa formats and new format_pack functions to reduce source code in _mesa_pack_rgba_span_from_ints() and _mesa_pack_rgba_span_from_uints(). Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: use format conversion functions in swrastSamuel Iglesias Gonsalvez1-1237/+122
This commit adds a macro to facilitate the task of using format conversions functions but keeps the same API. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa/formats: add new mesa formats and their pack/unpack functions.Samuel Iglesias Gonsalvez5-1/+145
This will be used to refactor code in pack.c and support conversion to/from these types in a master convert function that will be added later. v2: - Fix autogeneration of MESA_FORMAT_A2R10G10B10_UNORM pack/unpack functions Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa/format_pack: Add _mesa_pack_int_rgba_row()Samuel Iglesias Gonsalvez2-0/+88
This will be used to unify code in pack.c. v2: - Modify pack_int_*() function generator to use c.datatype() and f.datatype() v3: - Only autogenerate pack_int_*() functions for non-normalized integer formats. v4: - Use _mesa_unsigned_to_unsigned() in pack_int_*() because, in order to be able to pack both signed and unsigned formats, we need to sign-extend. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Add _mesa_pack_uint_rgba_row() format conversion functionSamuel Iglesias Gonsalvez2-0/+87
We will use this later on to handle uint conversion scenarios in a master convert function. v2: - Modify pack_uint_*() function generation to use c.datatype() and f.datatype(). - Remove UINT_TO_FLOAT() macro usage from pack_uint*() - Remove "if not f.is_normalized()" conditional as pack_uint*() functions are only autogenerated for non normalized formats. v3: - Add clamping for non-normalized integer formats in pack_uint*() Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Autogenerate format_unpack.cJason Ekstrand6-4396/+915
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> v2 by Samuel Iglesias <siglesias@igalia.com>: - Add usage of INDENT_FLAGS in Makefile.am v3 by Samuel Iglesias <siglesias@igalia.com>: - Modify unpack_float_*() and unpack_ubyte_*() function generation to use c.datatype() and f.datatype() - Fix out-of-tree build v4 by Samuel Iglesias <siglesias@igalia.com>: - format_unpack.c.mako is now format_unpack.py, with the template code inlined. It now auto-generates format_unpack.c - Add format_unpack.c to gitignore. - Simplify Makefile.am change - Modify SConscript to build format_unpack.c with scons v5 by Samuel Iglesias <siglesias@igalia.com>: - Don't allow float to non-normalized integer format conversions. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Autogenerate most of format_pack.cJason Ekstrand7-2983/+985
We were auto-generating it before. The problem was that the autogeneration tool we were using was called "copy, paste, and edit". Let's use a more sensible solution. Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> v2 by Samuel Iglesias <siglesias@igalia.com> - Remove format_pack.c as it is now autogenerated - Add usage of INDENT_FLAGS in Makefile.am - Remove trailing blank line v3 by Samuel Iglesias <siglesias@igalia.com> - Merge format_convert.py into format_parser.py - Adapt pack_*_* function generations - Fix out-of-tree build v4 by Samuel Iglesias <siglesias@igalia.com> - _get_datatype() is now a helper function v5 by Samuel Iglesias <siglesias@igalia.com> - format_pack.c.mako is now format_pack.py, with the template code inlined. It now auto-generates format_pack.c - Simplify Makefile.am change. - Modify SConscript to build format_pack.c with scons. - Remove run_mako.py - Add format_pack.c to gitignore v6 by Samuel Iglesias <siglesias@igalia.com>: - Don't allow float to non-normalized integer format conversions. - Add non-normalized formats support for ubyte packing functions. Merge the previously separated patch. - Add clamping for non-normalized integer formats in pack_ubyte*() v7 by Samuel Iglesias <siglesias@igalia.com>: - Add assert to check that sRGB formats are 8-bit size. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12configure: require python mako moduleSamuel Iglesias Gonsalvez3-1/+68
It is now a hard dependency because of the autogeneration of format pack and unpack functions. Update the documentation to reflect this change. v2: - Inline python script in m4 file and use PYTHON2 v3: - Remove semicolons and quotes and change coding style - Add Ilia Mirkin suggestion to use Python's split functionality. - Use AX_CHECK_PYTHON_MAKO_MODULE name. - Change to MIT license Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-01-12mesa: Add a _mesa_is_format_color_format helperJason Ekstrand2-0/+22
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2015-01-12mesa: Let _mesa_get_format_base_format also handle mesa_array_format.Iago Toral Quiroga2-4/+74
If we need the base format for a mesa_array_format we have to find the matching mesa_format first. This is expensive because it requires to loop through all existing mesa formats until we find the right match. We can resolve the base format of an array format directly by looking at its swizzle information. Also, we can have _mesa_get_format_base_format accept an uint32_t which can pack either a mesa_format or a mesa_array_format and resolve the base format for either type. This way clients do not need to check if they have a mesa_format or a mesa_array_format and call different functions depending on the case. Another reason to resolve the base format for array formats directly is that we don't have matching mesa_format enums for every possible array format, so for some GL format/type combinations we can produce array formats that don't have a corresponding mesa format, in which case we would not be able to find the base format. Example format=GL_RGB, type=GL_UNSIGNED_SHORT. This type would map to something like MESA_FORMAT_RGB_UNORM16, but we don't have that. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>