summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/image.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: replace _mesa_problem() with unreachable() in _mesa_convert_colors()Timothy Arceri2017-05-161-1/+1
| | | | Reviewed-by: Samuel Pitoiset <[email protected]>
* mesa/main: fix integer overflows in _mesa_image_offsetNicolai Hähnle2016-06-151-4/+4
| | | | | | | Found using -fsanitize=undefined. Cc: "11.1 11.2 12.0" <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: small optimization of _mesa_expand_bitmap()Brian Paul2016-02-191-7/+4
| | | | | | Avoid a per-pixel multiply. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa/image: Make _mesa_clip_readpixels() work with renderbuffersNanley Chery2016-02-091-5/+17
| | | | | | | | | v2: Use gl_renderbuffer::{Width,Height} (Jason) Cc: "11.0 11.1" <[email protected]> Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: fix SwapBytes handling in numerous placesDave Airlie2015-09-021-5/+53
| | | | | | | | | | | | | | | | | | | In a number of places the SwapBytes handling didn't handle cases with GL_(UN)PACK_ALIGNMENT set and 7 byte width cases aligned to 8 bytes. This adds a common routine to swap bytes a 2D image and uses this code in: texture storage texture get readpixels swrast drawpixels. [airlied: updated with Brian's nitpicks]. Cc: "11.0" <[email protected]> Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-231-37/+37
| | | | Acked-by: Eric Anholt <[email protected]>
* mesa: Rename the CEILING() macro to DIV_ROUND_UP().Francisco Jerez2015-02-101-1/+1
| | | | | | | | | | Some people have complained that code using the CEILING() macro is difficult to understand because it's not immediately obvious what it is supposed to do until you go and look up its definition. Use a more descriptive name that matches the similar utility macro in the Linux kernel. Reviewed-by: Matt Turner <[email protected]>
* DD: Refactor BlitFramebuffer.Laura Ekstrand2015-02-021-6/+8
| | | | | | | | | In preparation for glBlitNamedFramebuffer, the DD table function BlitFramebuffer needs to accept two arbitrary framebuffer objects rather than assuming ctx->ReadBuffer and ctx->DrawBuffer. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add _mesa_swap2_copy and _mesa_swap4_copyIago Toral Quiroga2015-01-121-8/+17
| | | | | | | | | | | | | | | | | 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: remove outdated version lines in commentsRico Schüller2013-06-051-1/+0
| | | | Signed-off-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]>
* st/mesa: implement BlitFramebuffer using gallium blitMarek Olšák2012-09-301-2/+2
| | | | | | | | This also fixes a lot tests, especially all the clip-and-scissor-blit MSAA piglit tests. Tested-by: Michel Dänzer <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: move _mesa_error_check_format_and_type() to glformats.cBrian Paul2012-07-241-367/+0
| | | | | 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-368/+1
|
* mesa: move some format helper functions to glformats.cBrian Paul2012-07-241-395/+0
|
* mesa: add glformats integer type/format detection routinesJordan Justen2012-07-211-76/+0
| | | | | | | | | | | | _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]>
* mesa,st/mesa: implement GL_RGB565 from ARB_ES2_compatibilityMarek Olšák2012-07-131-0/+1
| | | | | | | | | | This was not implemented, because the spec was changed just recently. Everything has been in place already. Gallium has PIPE_FORMAT_B5G6R5_UNORM, while Mesa has MESA_FORMAT_RGB565. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: add missing GL_UNSIGNED_INT_10F_11F_11F_REV caseBrian Paul2012-02-131-0/+9
| | | | | | in _mesa_error_check_format_and_type(). Fixes https://bugs.freedesktop.org/show_bug.cgi?id=45967
* mesa: new _mesa_error_check_format_and_type() functionBrian Paul2012-02-071-62/+154
| | | | | | | | | | | | | | | | | | | | This replaces the _mesa_is_legal_format_and_type() function. According to the spec, some invalid format/type combinations to glDrawPixels, ReadPixels and glTexImage should generate GL_INVALID_ENUM but others should generate GL_INVALID_OPERATION. With the old function we didn't make that distinction and generated GL_INVALID_ENUM errors instead of GL_INVALID_OPERATION. The new function returns one of those errors or GL_NO_ERROR. This will also let us remove some redundant format/type checks in follow-on commit. v2: add more checks for ARB_texture_rgb10_a2ui at the top of _mesa_error_check_format_and_type() per Ian. Signed-off-by: Brian Paul <[email protected]>
* mesa: allow exposing GL3 without EXT_texture_integerMarek Olšák2012-01-251-4/+8
| | | | | | | | | | | Strictly speaking, it's not legal to expose EXT_texture_integer without EXT_gpu_shader4. It might be even dangerous (apps can assume EXT_gpu_shader4 is available without checking for it). The check in compute_version is removed as well, because that's already covered by GLSLVersion >= 130. Reviewed-by: Brian Paul <[email protected]>
* mesa: Add missing integer R/RG cases to _mesa_is_color_format().Eric Anholt2012-01-241-0/+12
| | | | | | | | | This is part of fixing Intel oglconform negative.typeFormatMismatch.copyteximage. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: Brian Paul <[email protected]>
* mesa: add missing RG_INTEGER and some RED_INTEGER_EXT checks.Dave Airlie2011-12-101-0/+4
| | | | | | | | | | | This just adds the correct checks and asserts in the right places. This doesn't fix all the tests that I've sent to piglit, need to add int paths to go alongside the uint paths that don't go via float to fix it up properly. I'm not sure how much of that could be templated/shared will have a look once I write it the long way. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* mesa: add _mesa_image_offset()nobled2011-12-081-17/+50
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa/image: assert on bad formatnobled2011-12-081-11/+9
| | | | | | | | | | | | | | | | | NULL as an error indicator is meaningless, since it will return NULL on success anyway if the caller passes in zero as the image's address and asks to calculate the offset of the first pixel. For example, _mesa_validate_pbo_access() does this. This also matches the code in the non-GL_BITMAP codepath, which already has an assert like this. v2: Per Brian Paul's review, remove the function call entirely and tighten the assert to only accept the two formats compatible with GL_BITMAP. They always have one component per pixel. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa/image: delete dead storenobled2011-12-081-7/+0
| | | | | | The return value here is a) always zero, b) never used. Reviewed-by: Brian Paul <[email protected]>
* mesa: use malloc instead of MAX_WIDTH array in _mesa_convert_colors()Brian Paul2011-12-081-1/+7
| | | | | Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: add support for GL_OES_compressed_ETC1_RGB8_textureChia-I Wu2011-12-021-0/+3
| | | | | | | | | | | 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: Make _mesa_is_stencil_format() consistent with _mesa_is_depth_format().Eric Anholt2011-11-291-1/+0
| | | | | | | | | | | | | | | | | There was only one consumer of this API, meta.c, which was intending to ask "is this format just stencil index (and nothing else)?". Instead, if one tried to glDrawPixels of GL_DEPTH_STENCIL-type formats, it would just try to draw the stencil parts. Nothing good came of this. This function looks rather silly at this point, but I'm leaving it in place to be the obvious parallel API to _mesa_is_depth_format(). Note that if you want the old behavior, you should use it as (_mesa_is_stencil_format() || _mesa_is_depthstencil_format()) like is commonly done for depth-related tests. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: move _mesa_base_format_has_channel() into image.cBrian Paul2011-11-281-0/+87
| | | | | | This is where other format-related functions live. Reviewed-by: Eric Anholt <[email protected]>
* mesa/format: add mesa MESA_FORMAT_ARGB2101010_UINT support.Dave Airlie2011-11-281-0/+2
| | | | | | | | | | | | | | This format is used in the ARB_texture_rgb10_a2ui spec. It adds core mesa support, texformat + texstore support, format_unpack and fbobject.c (all patches from list merged + fixed up). also fixes some whitespace issues. Parts were: Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* image/pack: fix missing GL_BGR(A)_INTEGER support.Dave Airlie2011-11-281-0/+2
| | | | | | | These codepaths were missing the cases for BGR_INTEGER/BGRA_INTEGER. Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* image: fix legal types for packed integer formats.Dave Airlie2011-11-271-2/+4
| | | | | | | | | After reading ARB_texture_rgb10_a2ui it appears the packed formats for integer types are only specified via this extension, and not via the original ones. So condition the checks on this. Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Include R/RG integer textures in _mesa_is_integer_format.Eric Anholt2011-11-151-0/+12
| | | | | | | | Fixes some spurious GL errors in the upcoming gl-3.0-required-sized-formats piglit test. Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: new BYTE/SHORT_TO_FLOATZ() macrosBrian Paul2011-11-151-16/+0
| | | | | | | Rather than redefining the BYTE/SHORT_TO_FLOAT macros, just define new ones with different names. These macros preserve zero when converting. Reviewed-by: Eric Anholt <[email protected]>
* mesa: move CEILING() macro into macros.hBrian Paul2011-11-151-3/+0
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa: consolidate cases in _mesa_components_in_format()Brian Paul2011-11-151-28/+12
| | | | | | and _mesa_sizeof_packed_type() Reviewed-by: Eric Anholt <[email protected]>
* mesa: s/INLINE/inline/Brian Paul2011-10-011-2/+2
| | | | | | | INLINE is still seen in some files (some generated files, etc) but this is a good start. Acked-by: Kenneth Graunke <[email protected]>
* mesa: Add GL_OES_compressed_paletted_texture formats to ↵Ian Romanick2011-09-191-0/+13
| | | | | | | | _mesa_is_compressed_format Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Tested-by: Jin Yang <[email protected]>
* mesa/colormac: introduce inline helper for 4 unclamped float to ubyte.Dave Airlie2011-09-141-6/+2
| | | | | | | | | This introduces an UNCLAMPED_FLOAT_TO_UBYTE x 4 inline function, as suggested by Brian. It uses it in a few places I noticed from previous color changes, and also some core mesa places. I haven't updated other places yet. Signed-off-by: Dave Airlie <[email protected]>
* mesa: Remove all mention of GL_COLOR_INDEX*_EXTIan Romanick2011-09-061-27/+0
| | | | | | | | These enums were only valid with the paletted texture extensions. This allows a couple other trivial clean-ups. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: initial ARB_depth_buffer_float supportMarek Olšák2011-07-101-2/+16
| | | | | | | Using GL_NONE as DataType of Z32_FLOAT_X24S8, not sure what I should put there. The spec says the type is n/a. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: implement EXT_packed_floatMarek Olšák2011-04-291-0/+11
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: implement EXT_texture_shared_exponentMarek Olšák2011-04-291-0/+11
| | | | | | | | | swrast support done. There is no renderbuffer support in swrast, because it's not required by the extension. Reviewed-by: Brian Paul <[email protected]>
* mesa: initial EXT_texture_snorm supportMarek Olšák2011-03-291-3/+25
| | | | | The component ordering of some formats has been been reversed to match Gallium types.
* mesa: add ATI_texture_compression_3dcMarek Olšák2011-03-081-0/+3
| | | | | | | 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/+9
| | | | | | | | | | | | | | | | | 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.
* mesa: fix comments for _mesa_clip_readpixels()Brian Paul2011-02-171-2/+2
|