aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
Commit message (Collapse)AuthorAgeFilesLines
* 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]>
* mesa: Fix incorrect assertion in init_teximage_fields_msIago Toral Quiroga2015-01-121-1/+1
| | | | | | | | | | | | | | | | _BaseFormat is a GLenum (unsigned int) so testing if its value is greater than 0 to detect the cases where _mesa_base_tex_format returns -1 doesn't work. Fixing the assertion breaks the arb_texture_view-lifetime-format piglit test on nouveau, since that test calls _mesa_base_tex_format with GL_R16F with a context that does not have ARB_texture_float, so it returns -1 for the BaseFormat, which was not being caught properly by the ASSERT in init_teximage_fields_ms until now. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Fix get_texbuffer_format().Samuel Iglesias Gonsalvez2015-01-121-2/+2
| | | | | | | | | We were returning incorrect mesa formats for GL_LUMINANCE_ALPHA16I_EXT and GL_LUMINANCE_ALPHA32I_EXT. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Fix A1R5G5B5 packing/unpackingJason Ekstrand2015-01-123-15/+7
| | | | | | | | As with B5G6R5, these have been left broken with comments saying they are. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa/colormac: Remove an unused macroJason Ekstrand2015-01-121-3/+0
| | | | | | | | | The PACK_565_REV macro is no longer used. It was also extremely confusing because it's actually a byteswapped 565 not reversed 565. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Fix packing/unpacking of MESA_FORMAT_R5G6B5_UNORMJason Ekstrand2015-01-125-23/+14
| | | | | | | | | | | | | | Aparently, the packing/unpacking functions for these formats have differed from the format description in formats.h. Instead of fixing this, people simply left a comment saying it was broken. Let's actually fix it for real. v2 by Samuel Iglesias <[email protected]>: - Fix comment in formats.h Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* mesa: Fix clamping to -1.0 in snorm_to_floatJason Ekstrand2015-01-121-1/+1
| | | | | | | | | | | | | This patch fixes the return of a wrong value when x is lower than -MAX_INT(src_bits) as the result would not be between [-1.0 1.0]. v2 by Samuel Iglesias <[email protected]>: - Modify snorm_to_float() to avoid doing the division when x == -MAX_INT(src_bits) Cc: 10.4 <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Always generate GL_INVALID_OPERATION in _mesa_GetProgramBinaryIan Romanick2015-01-121-0/+2
| | | | | | | | | | | There are no binary formats supported, so what are you doing? At least this gives the application developer some feedback about what's going on. The spec gives no guidance about what to do in this scenario. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87516 Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Leight Bade <[email protected]>
* mesa: Ensure that length is set to zero in _mesa_GetProgramBinaryIan Romanick2015-01-121-6/+20
| | | | | | | | | v2: Fix assignment of length. Noticed by Julien Cristau. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87516 Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Leight Bade <[email protected]>
* mesa: Add missing error checks in _mesa_ProgramBinaryIan Romanick2015-01-121-2/+25
| | | | | | | Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87516 Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Leight Bade <[email protected]>
* mesa: compute row stride outside of loop and fix MSVC compilation errorBrian Paul2015-01-081-2/+4
| | | | | | Can't do void pointer arithmetic with MSVC. Reviewed-by: Jose Fonseca <[email protected]>
* mesa: fix MSVC compilation errorsBrian Paul2015-01-081-5/+5
| | | | | | Move assertions after declarations and don't use void pointer arithmetic. Reviewed-by: Jose Fonseca <[email protected]>
* main: Checking for cube completeness in TextureSubImage.Laura Ekstrand2015-01-081-13/+35
| | | | | | | | This is part of a potential solution to a spec bug. Cube completeness is a concept from glGenerateMipmap, but it seems reasonable to check for it in TextureSubImage when target=GL_TEXTURE_CUBE_MAP. Reviewed-by: Anuj Phogat <[email protected]>
* main: Checking for cube completeness in GetTextureImage.Laura Ekstrand2015-01-081-12/+35
| | | | | | | | This is part of a potential solution to a spec bug. Cube completeness is a concept from glGenerateMipmap, but it seems reasonable to check for it in GetTextureImage when the target is GL_TEXTURE_CUBE_MAP. Reviewed-by: Anuj Phogat <[email protected]>
* main: Added _mesa_cube_level_complete to check for the completeness of an ↵Laura Ekstrand2015-01-082-9/+18
| | | | | | arbitrary cube map level. Reviewed-by: Chad Versace <[email protected]>
* main: glDeleteTextures now throws GL_INVALID_VALUE if n is negative.Laura Ekstrand2015-01-081-0/+5
| | | | | | This is in conformance with the OpenGL spec. Reviewed-by: Anuj Phogat <[email protected]>
* main: Refactor in teximage.c to handle NULL from _mesa_get_current_tex_object.Laura Ekstrand2015-01-081-0/+22
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glTextureBuffer.Laura Ekstrand2015-01-083-16/+86
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Fix texObj->Immutable flag update in _mesa_texture_image_multisample.Laura Ekstrand2015-01-081-1/+1
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry points for glTextureStorage[23]DMultisample.Laura Ekstrand2015-01-083-28/+118
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glGenerateTextureMipmap.Laura Ekstrand2015-01-083-20/+58
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry points for glCompressedTextureSubImage*D.Laura Ekstrand2015-01-083-52/+220
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glGetCompressedTextureImage.Laura Ekstrand2015-01-083-45/+134
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glGetTextureImage.Laura Ekstrand2015-01-083-66/+240
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Nameless texture creation and deletion. Does not affect normal ↵Laura Ekstrand2015-01-082-0/+69
| | | | | | | | | | | | | | | | | | | | creation and deletion paths. In implementing ARB_DIRECT_STATE_ACCESS functions, it is often necessary to abstract the functionality of a traditional GL API function into a backend that both the traditional and dsa API functions can share. For instance, glTexParameteri and glTextureParameteri both call _mesa_texture_parameteri, which takes a context object and a texture object as arguments. The existance of such backend functions provides the opportunity for driver internals (such as meta) to pass around the actual texture object rather than its ID or target, saving on texture object storage and look-up overhead. This patch provides nameless texture creation and deletion for meta. This will be used in an upcoming refactor of meta. Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry points for CopyTextureSubImage*D.Laura Ekstrand2015-01-083-48/+151
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Fixed some comments in texparam.cLaura Ekstrand2015-01-081-2/+2
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry points for glGetTextureParameteriv, Iiv, and Iuiv.Laura Ekstrand2015-01-083-34/+123
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glGetTextureParameterfv.Laura Ekstrand2015-01-083-12/+46
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry points for glGetTextureLevelParameteriv, fv.Laura Ekstrand2015-01-083-32/+117
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: legal_get_tex_level_parameter_target now handles GL_TEXTURE_CUBE_MAP.Laura Ekstrand2015-01-081-2/+13
| | | | | | | ARB_DIRECT_STATE_ACCESS functions allow an effective target of GL_TEXTURE_CUBE_MAP. Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry points for glTextureParameteriv, Iiv, Iuiv.Laura Ekstrand2015-01-083-34/+138
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glTextureParameteri.Laura Ekstrand2015-01-082-11/+52
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glTextureParameterfv.Laura Ekstrand2015-01-083-13/+47
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glTextureParameterf.Laura Ekstrand2015-01-083-10/+60
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added get_texobj_by_name in texparam.c.Laura Ekstrand2015-01-081-13/+51
| | | | | | This is a convenience function for *Texture*Parameter functions. Reviewed-by: Anuj Phogat <[email protected]>
* main: set_tex_parameterf now handles errors according to the OpenGL 4.5 ↵Laura Ekstrand2015-01-081-17/+20
| | | | | | | | | | | Specification. Beginning in the OpenGL 4.3 core specification, certain error handling has changed. One example shown here is that INVALID_ENUM is thrown instead of INVALID_OPERATION when a user attempts to set sampler parameters for a multisample target. Reviewed-by: Anuj Phogat <[email protected]>
* main: set_tex_parameteri now handles errors according to the OpenGL 4.5 ↵Laura Ekstrand2015-01-081-28/+42
| | | | | | | | | | | Specification. Beginning in the OpenGL 4.3 core specification, some error handling has changed (see OpenGL 4.5 core spec, 30.10.2014, Section 8.10 Texture Parameters, pages 228-29). As an example, changing sampler states with a multisample target throws INVALID_ENUM rather than INVALID_OPERATION. Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for BindTextureUnit.Laura Ekstrand2015-01-085-5/+150
| | | | | | | | | | | | | | | | | | | The following preparations were made in texstate.c and texstate.h to better facilitate the BindTextureUnit function: Dylan Noblesmith: mesa: add _mesa_get_tex_unit() mesa: factor out _mesa_max_tex_unit() This is about to appear in a lot more places, so reduce boilerplate copy paste. add _mesa_get_tex_unit_err() checking getter function Reduce boilerplate across files. Laura Ekstrand: Made note of why BindTextureUnit should throw GL_INVALID_OPERATION if the unit is out of range. Added assert(unit > 0) to _mesa_get_tex_unit. Reviewed-by: Anuj Phogat <[email protected]>
* main: Corrected comment on _mesa_is_zero_size_texture.Laura Ekstrand2015-01-081-1/+1
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry points for glTextureSubImage*D.Laura Ekstrand2015-01-083-81/+284
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry points for glTextureStorage*D.Laura Ekstrand2015-01-083-51/+189
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glCreateTextures.Laura Ekstrand2015-01-083-26/+90
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Removed trailing whitespaces in texture code.Laura Ekstrand2015-01-082-28/+28
| | | | | | | | main: Removed trailing whitespace in texstate.c. main: Deleted trailing whitespaces in texobj.c. main: Fixed whitespace errors in teximage.h and teximage.c. Reviewed-by: Anuj Phogat <[email protected]>
* main: Renamed _mesa_get_compressed_teximage to _mesa_GetCompressedTexImage_sw.Laura Ekstrand2015-01-082-6/+6
| | | | | | | | This reflects the new naming convention for software fallbacks. To avoid confusion with ARB_DIRECT_STATE_ACCESS backend functions, software fallbacks now have the form _mesa_[Driver function name]_sw. Reviewed-by: Anuj Phogat <[email protected]>
* main: Renamed _mesa_get_teximage to _mesa_GetTexImage_sw.Laura Ekstrand2015-01-082-6/+6
| | | | | | | | This reflects the new naming convention for software fallbacks. To avoid confusion with ARB_DIRECT_STATE_ACCESS backend functions, software fallbacks now have the form _mesa_[Driver function name]_sw. Reviewed-by: Anuj Phogat <[email protected]>