aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
Commit message (Collapse)AuthorAgeFilesLines
...
* mesa: Returns a GL_INVALID_VALUE error if num of fbos in ↵Eduardo Lima Mitev2015-01-131-0/+5
| | | | | | | | | | | | | glDeleteRenderbuffers is negative Per GLES3 manual for glDeleteRenderbuffers <https://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteRenderbuffers.xhtml>, GL_INVALID_VALUE is generated if n is negative. Fixes 1 dEQP test: * dEQP-GLES3.functional.negative_api.buffer.delete_renderbuffers Reviewed-by: Ian Romanick <[email protected]>
* mesa: Returns a GL_INVALID_VALUE error if num of fbos in ↵Eduardo Lima Mitev2015-01-131-0/+5
| | | | | | | | | | | | | glDeleteFramebuffers is negative Per GLES3 manual for glDeleteFramebuffers <https://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteFramebuffers.xhtml>, GL_INVALID_VALUE is generated if n is negative. Fixes 1 dEQP test: * dEQP-GLES3.functional.negative_api.buffer.delete_framebuffers Reviewed-by: Ian Romanick <[email protected]>
* mesa: Allows querying GL_SAMPLER_BINDING on GLES3 profileEduardo Lima Mitev2015-01-131-4/+5
| | | | | | | | | | | | | | From GLES3 specification (page 123), "The currently bound sampler may be queried by calling GetIntegerv with pname set to SAMPLER_BINDINGGL_SAMPLER_BINDING". Fixes 4 dEQP tests: * dEQP-GLES3.functional.state_query.integers.sampler_binding_getboolean * dEQP-GLES3.functional.state_query.integers.sampler_binding_getinteger * dEQP-GLES3.functional.state_query.integers.sampler_binding_getinteger64 * dEQP-GLES3.functional.state_query.integers.sampler_binding_getfloat Reviewed-by: Ian Romanick <[email protected]>
* main: round floating-point value to nearest integer in glGetSamplerParameteriv()Samuel Iglesias Gonsalvez2015-01-131-4/+16
| | | | | | | | | | | | | | | | 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 2 dEQP tests: dEQP-GLES3.functional.state_query.sampler.sampler_texture_min_lod_getsamplerparameteri dEQP-GLES3.functional.state_query.sampler.sampler_texture_max_lod_getsamplerparameteri Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* main: round floating-point value to nearest integer in glGetTexParameteriv()Samuel Iglesias Gonsalvez2015-01-131-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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* main: fix return GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL valueSamuel Iglesias Gonsalvez2015-01-131-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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Depth and stencil attachments must be the same in OpenGL ES3Iago Toral Quiroga2015-01-131-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 <[email protected]>
* mesa: Initializes the stencil value masks to 0xFF instead of ~0uEduardo Lima Mitev2015-01-131-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 <[email protected]>
* main: Remove comparison unsigned int >= 0.Laura Ekstrand2015-01-121-1/+0
| | | | | | Fixes "macro compares unsigned to 0 (NO_EFFECT)" found by Coverity Scan. Reviewed-by: Matt Turner <[email protected]>
* mesa/main: In _mesa_CompressedTextureSubImage3D() check found texObjJuha-Pekka Heikkila2015-01-121-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 <[email protected]>
* mesa: Move declarations to to of block.José Fonseca2015-01-121-3/+3
| | | | | | To fix MSVC build. Trivial.
* mesa: restrict use of GL_ABGR_EXT format to allowed data typesSamuel Iglesias Gonsalvez2015-01-124-52/+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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Remove _mesa_rebase_rgba_uint and _mesa_rebase_rgba_floatIago Toral Quiroga2015-01-122-133/+0
| | | | | | These are no longer used anywhere now that we have _mesa_format_convert. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Remove _mesa_pack_int_rgba_row() and auxiliary functionsSamuel Iglesias Gonsalvez2015-01-122-89/+0
| | | | | | | These are no longer used. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Remove _mesa_(un)pack_index_spanIago Toral Quiroga2015-01-122-234/+0
| | | | | | These are not used anywhere. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Remove _mesa_pack_rgba_span_float and tmp_pack.hIago Toral Quiroga2015-01-123-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 <[email protected]>
* mesa: Remove _mesa_unpack_color_span_floatIago Toral Quiroga2015-01-122-1042/+0
| | | | | | And various helper functions that went unused after removing it. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Remove (signed) integer pack and span functions.Iago Toral Quiroga2015-01-122-237/+0
| | | | | | These are no longer used now that we moved to _mesa_format_convert. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Remove _mesa_unpack_color_span_ubyteIago Toral Quiroga2015-01-122-265/+0
| | | | | | This is no longer used anywhere after moving to _mesa_format_convert. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Remove _mesa_make_temp_float_imageIago Toral Quiroga2015-01-124-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 <[email protected]>
* mesa: Remove _mesa_make_temp_ubyte_imageIago Toral Quiroga2015-01-126-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 <[email protected]>
* mesa: Remove _mesa_unpack_color_span_uintIago Toral Quiroga2015-01-122-652/+0
| | | | | | This is no longer used. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Replace _mesa_unpack_bitmap with _mesa_unpack_image()Eduardo Lima Mitev2015-01-123-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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Let _mesa_swizzle_and_convert take array format types instead of GL typesIago Toral Quiroga2015-01-122-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 <[email protected]>
* mesa: Use _mesa_format_convert to implement get_tex_rgba_compressed.Iago Toral Quiroga2015-01-121-39/+34
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: use _mesa_format_convert to implement get_tex_rgba_uncompressed.Iago Toral Quiroga2015-01-121-117/+133
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: use _mesa_format_convert to implement glReadPixels.Iago Toral Quiroga2015-01-121-142/+184
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Use _mesa_format_convert to implement texstore_rgba.Iago Toral Quiroga2015-01-121-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 <[email protected]>
* mesa: Add helpers to extract GL_COLOR_INDEX to RGBA float/ubyteIago Toral Quiroga2015-01-122-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 <[email protected]>
* mesa: Add RGBA to Luminance conversion helpersIago Toral Quiroga2015-01-122-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 <[email protected]>
* mesa: Add _mesa_swap2_copy and _mesa_swap4_copyIago Toral Quiroga2015-01-122-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 <[email protected]>
* mesa/pack: use _mesa_format_from_format_and_type in _mesa_pack_rgba_span_from_*Samuel Iglesias Gonsalvez2015-01-121-256/+26
| | | | | | | | We had previously added the needed mesa formats, so we can simplify the code further. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Add helper to convert a GL format and type to a mesa (array) format.Iago Toral Quiroga2015-01-122-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 <[email protected]>
* mesa: Add a helper _mesa_compute_rgba2base2rgba_component_mappingIago Toral Quiroga2015-01-122-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 <[email protected]>
* mesa: Add a rebase_swizzle parameter to _mesa_format_convertIago Toral Quiroga2015-01-122-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 <[email protected]>
* mesa: Expose compute_component_mapping as _mesa_compute_component_mappingIago Toral Quiroga2015-01-123-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 <[email protected]>
* mesa: Add an implementation of a master convert function.Jason Ekstrand2015-01-122-0/+418
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | v2 by Iago Toral <[email protected]>: - 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 <[email protected]>: - Add an RGBA8888_INT definition. v4 by Iago Toral <[email protected]> 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 <[email protected]>: - Adapted to the new implementation of mesa_array_format as a plain uint32_t bitfield. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/pack: refactor _mesa_pack_rgba_span_float()Samuel Iglesias Gonsalvez2015-01-122-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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/main/pack_tmp.h: Add float conversion supportSamuel Iglesias Gonsalvez2015-01-121-1/+74
| | | | | | | We will use this in a later patch to refactor _mesa_pack_rgba_span_float. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/pack: use autogenerated format_pack functionsSamuel Iglesias Gonsalvez2015-01-121-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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/formats: add new mesa formats and their pack/unpack functions.Samuel Iglesias Gonsalvez2015-01-124-1/+132
| | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/format_pack: Add _mesa_pack_int_rgba_row()Samuel Iglesias Gonsalvez2015-01-122-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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Add _mesa_pack_uint_rgba_row() format conversion functionSamuel Iglesias Gonsalvez2015-01-122-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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Autogenerate format_unpack.cJason Ekstrand2015-01-123-4394/+897
| | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Jason Ekstrand <[email protected]> v2 by Samuel Iglesias <[email protected]>: - Add usage of INDENT_FLAGS in Makefile.am v3 by Samuel Iglesias <[email protected]>: - Modify unpack_float_*() and unpack_ubyte_*() function generation to use c.datatype() and f.datatype() - Fix out-of-tree build v4 by Samuel Iglesias <[email protected]>: - 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 <[email protected]>: - Don't allow float to non-normalized integer format conversions. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Autogenerate most of format_pack.cJason Ekstrand2015-01-124-2982/+968
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> v2 by Samuel Iglesias <[email protected]> - 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 <[email protected]> - Merge format_convert.py into format_parser.py - Adapt pack_*_* function generations - Fix out-of-tree build v4 by Samuel Iglesias <[email protected]> - _get_datatype() is now a helper function v5 by Samuel Iglesias <[email protected]> - 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 <[email protected]>: - 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 <[email protected]>: - Add assert to check that sRGB formats are 8-bit size. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Add a _mesa_is_format_color_format helperJason Ekstrand2015-01-122-0/+22
| | | | | Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* mesa: Let _mesa_get_format_base_format also handle mesa_array_format.Iago Toral Quiroga2015-01-122-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 <[email protected]>
* main: Add a concept of an array formatJason Ekstrand2015-01-123-1/+209
| | | | | | | | | | | | | | | | | | | | An array format is a 32-bit integer format identifier that can represent any format that can be represented as an array of standard GL datatypes. Whie the MESA_FORMAT enums provide several of these, they don't account for all of them. v2 by Iago Toral Quiroga <[email protected]>: - Implement mesa_array_format as a plain bitfiled uint32_t type instead of using a struct inside a union to access the various components packed in it. This is necessary to support bigendian properly, as pointed out by Ian. - Squashed: Make float types normalized v3 by Iago Toral Quiroga <[email protected]>: - Include compiler.h in formats.h, which is necessary to build in MSVC as indicated by Brian Paul. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Fix _mesa_swizzle_and_convert integer conversions to clamp properlySamuel Iglesias Gonsalvez2015-01-122-53/+94
| | | | | | | | | | | | | | | | | | | | | | | | | Fix various conversion paths that involved integer data types of different sizes (uint16_t to uint8_t, int16_t to uint8_t, etc) that were not being clamped properly. Also, one of the paths was incorrectly assigning the value 12, instead of 1, to the constant "one". v2: - Create auxiliary clamping functions and use them in all paths that required clamp because of different source and destination sizes and signed-unsigned conversions. v3: - Create MIN_INT macro and use it. v4: - Add _mesa_float_to_[un]signed() and mesa_half_to_[un]signed() auxiliary functions. - Add clamp for float-to-integer conversions in _mesa_swizzle_and_convert() Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/format_utils: Prefix and expose the conversion helper functionsJason Ekstrand2015-01-122-161/+159
| | | | | | | | | | | Signed-off-by: Jason Ekstrand <[email protected]> v2 by Samuel Iglesias <[email protected]>: - Fix compilation errors Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>