summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/readpix.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: allow buffers mapped with the persistent flag to be used by the GPUMarek Olšák2014-02-251-1/+1
| | | | | | v2: also fixed InvalidateBufferData, added citations from the 4.4 spec Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: Fix MESA_FORMAT_Z24_UNORM_S8_UINT vs. X8_UINT mix-up.Kenneth Graunke2014-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | In commit eeed49f5f290793870c60b5b635b977a732a1eb4, Mark accidentally renamed MESA_FORMAT_S8_Z24 to MESA_FORMAT_Z24_UNORM_X8_UINT and MESA_FORMAT_X8_Z24 to MESA_FORMAT_Z24_UNORM_S8_UINT, reversing their sense. The commit message was correct, but what sed commands actually got run didn't match that. This patch swaps the two enum names, reversing them. This should undo the damage, but might break things if people have manually fixed a few instances in the meantime... Mark's commit also failed to mention renames: s/MESA_FORMAT_ARGB2101010_UINT\b/MESA_FORMAT_B10G10R10A2_UINT/g s/MESA_FORMAT_ABGR2101010\b/MESA_FORMAT_R10G10B10A2_UNORM/g but those seem okay. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: Change many Type P MESA_FORMATs to meet naming specMark Mueller2014-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conversion of Type P formats as follows (w/related comment fixes): s/MESA_FORMAT_RGB565\b/MESA_FORMAT_B5G6R5_UNORM/g s/MESA_FORMAT_RGB565_REV\b/MESA_FORMAT_R5G6B5_UNORM/g s/MESA_FORMAT_ARGB4444\b/MESA_FORMAT_B4G4R4A4_UNORM/g s/MESA_FORMAT_ARGB4444_REV\b/MESA_FORMAT_A4R4G4B4_UNORM/g s/MESA_FORMAT_RGBA5551\b/MESA_FORMAT_A1B5G5R5_UNORM/g s/MESA_FORMAT_XBGR8888_SNORM\b/MESA_FORMAT_R8G8B8X8_SNORM/g s/MESA_FORMAT_XBGR8888_SRGB\b/MESA_FORMAT_R8G8B8X8_SRGB/g s/MESA_FORMAT_ARGB1555\b/MESA_FORMAT_B5G5R5A1_UNORM/g s/MESA_FORMAT_ARGB1555_REV\b/MESA_FORMAT_A1R5G5B5_UNORM/g s/MESA_FORMAT_AL44\b/MESA_FORMAT_L4A4_UNORM/g s/MESA_FORMAT_RGB332\b/MESA_FORMAT_B2G3R3_UNORM/g s/MESA_FORMAT_ARGB2101010\b/MESA_FORMAT_B10G10R10A2_UNORM/g s/MESA_FORMAT_Z24_S8\b/MESA_FORMAT_S8_UINT_Z24_UNORM/g s/MESA_FORMAT_S8_Z24\b/MESA_FORMAT_Z24_UNORM_S8_UINT/g s/MESA_FORMAT_X8_Z24\b/MESA_FORMAT_Z24_UNORM_X8_UINT/g s/MESA_FORMAT_Z24_X8\b/MESA_FORMAT_X8Z24_UNORM/g s/MESA_FORMAT_RGB9_E5_FLOAT\b/MESA_FORMAT_R9G9B9E5_FLOAT/g s/MESA_FORMAT_R11_G11_B10_FLOAT\b/MESA_FORMAT_R11G11B10_FLOAT/g s/MESA_FORMAT_Z32_FLOAT_X24S8\b/MESA_FORMAT_Z32_FLOAT_S8X24_UINT/g s/MESA_FORMAT_ABGR2101010_UINT\b/MESA_FORMAT_R10G10B10A2_UINT/g s/MESA_FORMAT_XRGB4444_UNORM\b/MESA_FORMAT_B4G4R4X4_UNORM/g s/MESA_FORMAT_XRGB1555_UNORM\b/MESA_FORMAT_B5G5R5X1_UNORM/g s/MESA_FORMAT_XRGB2101010_UNORM\b/MESA_FORMAT_B10G10R10X2_UNORM/g s/MESA_FORMAT_AL88\b/MESA_FORMAT_L8A8_UNORM/g s/MESA_FORMAT_AL88_REV\b/MESA_FORMAT_A8L8_UNORM/g s/MESA_FORMAT_AL1616\b/MESA_FORMAT_L16A16_UNORM/g s/MESA_FORMAT_AL1616_REV\b/MESA_FORMAT_A16L16_UNORM/g s/MESA_FORMAT_RG88\b/MESA_FORMAT_G8R8_UNORM/g s/MESA_FORMAT_GR88\b/MESA_FORMAT_R8G8_UNORM/g s/MESA_FORMAT_GR1616\b/MESA_FORMAT_R16G16_UNORM/g s/MESA_FORMAT_RG1616\b/MESA_FORMAT_G16R16_UNORM/g s/MESA_FORMAT_SRGBA8\b/MESA_FORMAT_A8B8G8R8_SRGB/g s/MESA_FORMAT_SARGB8\b/MESA_FORMAT_B8G8R8A8_SRGB/g s/MESA_FORMAT_SLA8\b/MESA_FORMAT_L8A8_SRGB/g Conflicts: src/mesa/drivers/dri/i965/brw_surface_formats.c src/mesa/main/format_pack.c src/mesa/main/format_unpack.c src/mesa/main/formats.c src/mesa/main/texformat.c src/mesa/main/texstore.c
* mesa: Rename 4 color component unsigned byte MESA_FORMATsMark Mueller2014-01-271-2/+2
| | | | | | | | | | | | | Change all 4 color component unsigned byte formats to meet spec for P Type formats: s/MESA_FORMAT_RGBA8888\b/MESA_FORMAT_A8B8G8R8_UNORM/g s/MESA_FORMAT_RGBA8888_REV\b/MESA_FORMAT_R8G8B8A8_UNORM/g s/MESA_FORMAT_ARGB8888\b/MESA_FORMAT_B8G8R8A8_UNORM/g s/MESA_FORMAT_ARGB8888_REV\b/MESA_FORMAT_A8R8G8B8_UNORM/g s/MESA_FORMAT_RGBX8888\b/MESA_FORMAT_X8B8G8R8_UNORM/g s/MESA_FORMAT_RGBX8888_REV\b/MESA_FORMAT_R8G8B8X8_UNORM/g s/MESA_FORMAT_XRGB8888\b/MESA_FORMAT_B8G8R8X8_UNORM/g s/MESA_FORMAT_XRGB8888_REV\b/MESA_FORMAT_X8R8G8B8_UNORM/g
* mesa: change gl_format to mesa_formatMark Mueller2014-01-271-3/+3
| | | | s/\bgl_format\b/mesa_format/g. Use better name for Mesa Formats enum
* 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: refactor clamping controls, get rid of _ClampReadColorMarek Olšák2013-04-061-2/+3
| | | | | | v2: cosmetic changes from Brian's email Reviewed-by: Brian Paul <[email protected]>
* mesa: add common format-independent memcpy-based ReadPixels pathMarek Olšák2013-03-231-34/+160
| | | | | | | | | | | I'll need the _mesa_readpixels_needs_slow_path function for the blit-based version, but it's also useful to have this memcpy-based path in one place and not scattered across several functions. v2: add "const" to function parameters Reviewed-by: Brian Paul <[email protected]> Tested-by: Brian Paul <[email protected]>
* mesa: add a common function returning transfer ops for ReadPixelsMarek Olšák2013-03-231-20/+74
| | | | | | | | | | | I'll need both new functions for later. For now, it consolidates the code for determining what the transfer ops should be and makes it a little bit smarter. v2: added "const" Reviewed-by: Brian Paul <[email protected]> Tested-by: Brian Paul <[email protected]>
* mesa: Drop manual checks for outside begin/end.Eric Anholt2013-01-211-1/+1
| | | | | | | | | | | We now have a separate dispatch table for begin/end that prevent these functions from being entered during that time. The ASSERT_OUTSIDE_BEGIN_END_WITH_RETVALs are left because I don't want to change any return values or introduce new error-only stubs at this point. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* readpix: allow implementation format/typeJordan Justen2013-01-201-1/+6
| | | | | | | | | For GLES2/3 allow reading of pixels with format/type based on: * GL_IMPLEMENTATION_COLOR_READ_FORMAT * GL_IMPLEMENTATION_COLOR_READ_TYPE Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Jordan Justen <[email protected]>
* extensions: enable EXT_color_buffer_float for ES3Jordan Justen2013-01-201-0/+2
| | | | | | | | | [mattst88] v2: Enable only for ES3 per spec. [mattst88] v3: Use _mesa_is_gles3 since EXT_color_buffer_float is ES3-only. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Jordan Justen <[email protected]>
* readpix: check FBO completeness before trying to access the read-bufferJordan Justen2013-01-201-9/+9
| | | | | Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Jordan Justen <[email protected]>
* readpix: add error checking for GLES3Jordan Justen2013-01-201-0/+56
| | | | | Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Jordan Justen <[email protected]>
* mesa: Return INVALID_ENUM for glReadPixels(..., GL_DEPTH_*, ...) on ES 3Matt Turner2013-01-151-9/+13
| | | | | | | | | | | | | I'm not sure if this is the correct fix. The _mesa_es_error_check_format_and_type function (used above in the ES 1 and 2 cases) was originally added for glTexImage checking and allows GL_DEPTH_STENCIL/GL_UNSIGNED_INT_24_8 combinations. Using it in ES 3 causes other tests to regress. Fixes es3conform's packed_depth_stencil_error test. Reviewed-by: Kenneth Graunke <[email protected]> (v1) Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Fix segfault on reading from a missing color read buffer.Eric Anholt2012-11-171-11/+11
| | | | | | | | | | | | | | The diff looks funny, but it's moving the integer vs non-integer check below the _mesa_source_buffer_exists() check that ensures _ColorReadBuffer is non-null, so we get a GL_INVALID_OPERATION instead of a segfault. This looks like it had regressed in the _mesa_error_check_format_and_type() changes, which removed the first of the two duplicated checks for the source buffer. Fixes segfault in the new piglit ARB_framebuffer_object/negative-readpixels-no-rb. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45877 NOTE: This is a candidate for the stable branches. Reviewed-by: Brian Paul <[email protected]>
* mesa: move _mesa_es_error_check_format_and_type() to glformats.cBrian Paul2012-09-261-1/+0
| | | | | | Where the non-ES _mesa_error_check_format_and_type() function lives. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: move GL_HALF_FLOAT_OES definition to glheader.hBrian Paul2012-09-261-5/+0
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* Don't cast the return value of malloc/reallocMatt Turner2012-09-051-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has been generated by the following Coccinelle semantic patch: // Don't cast the return value of malloc/realloc. // // Casting the return value of malloc/realloc only stands to hide // errors. @@ type T; expression E1, E2; @@ - (T) ( _mesa_align_calloc(E1, E2) | _mesa_align_malloc(E1, E2) | calloc(E1, E2) | malloc(E1) | realloc(E1, E2) )
* mesa/es: Validate glReadPixels format and type in Mesa code rather than the ↵Ian Romanick2012-08-291-0/+33
| | | | | | | | ES wrapper v2: Add proper GLES3 filtering. Signed-off-by: Ian Romanick <[email protected]>
* mesa ReadPixels: handle signed/unsigned integer clampingJordan Justen2012-08-141-3/+10
| | | | | Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa pack: handle uint and int clamping properlyJordan Justen2012-08-141-2/+2
| | | | | | | | | | | Rename _mesa_pack_rgba_span_int to _mesa_pack_rgba_span_from_uints. Add _mesa_pack_rgba_span_from_ints. These separate routines allow the integer clamping to be handled properly for signed versus unsigned integers. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Make more consistent use of _mesa_is_{user,winsys}_fbo()Paul Berry2012-07-261-1/+3
| | | | | | | | | | A lot of code was still differentiating between between winsys and user fbos by testing the fbo's name against zero. This converts everything in core mesa, the state tracker, and src/mesa/program over to use _mesa_is_user_fbo() and _mesa_is_winsys_fbo(). Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: add glformats integer type/format detection routinesJordan Justen2012-07-211-3/+4
| | | | | | | | | | | | _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: Check for framebuffer completeness before looking at the rb.Eric Anholt2012-05-171-6/+6
| | | | | | | | | Otherwise, an incomplete framebuffer could have a NULL _ColorReadBuffer and we'd deref that. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: add a couple fast-paths to fast_read_rgba_pixels_memcpy()Brian Paul2012-04-171-7/+55
| | | | | | | | | | | | Accelerates a few glReadPixels cases for WebGL. See https://bugs.freedesktop.org/show_bug.cgi?id=48545 v2: Per Jose, use bit twiddling for the swizzle case instead of ubyte arrays (it's about 44% faster). Note: This is a candidate for the 8.0 branch. Reviewed-by: José Fonseca <[email protected]>
* mesa: use _mesa_rebase_rgba_float/uint() in glReadPixels codeBrian Paul2012-03-081-0/+4
| | | | | | | | | See the comments for _mesa_rebase_rgba_float() for details. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=46679 NOTE: This is a candidate for the 8.0 branch. Reviewed-by: José Fonseca <[email protected]>
* mesa: Don't disable fast path for normalized typesNeil Roberts2012-02-281-7/+15
| | | | | | | | | | | | | | | | | | Mesa has a fast path for the generic fallback when using glReadPixels for RGBA data which uses memcpy. However it was really difficult to hit this case because it would not be used if any transferOps are enabled. Any type apart from floating point or non-normalized integer types (so any of the common types) would force enabling clamping so the fast path could not be used. This patch makes it ignore clamping when determining whether to use the fast path if the data type of the buffer is an unsigned normalized type because in that case clamping will not have any effect anyway. https://bugs.freedesktop.org/show_bug.cgi?id=46631 NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Brian Paul <[email protected]>
* mesa: stop using MAX_WIDTH in glReadPixels codeBrian Paul2012-02-241-45/+75
| | | | Reviewed-by: José Fonseca <[email protected]>
* mesa: remove unused _mesa_error_check_format_type() functionBrian Paul2012-02-071-117/+0
| | | | | | | This was only used by glReadPixels and glDrawPixels. Now those functions do the corresponding error checks. Signed-off-by: Brian Paul <[email protected]>
* mesa: stop using _mesa_error_check_format_type() in glReadPixelsBrian Paul2012-02-071-2/+7
| | | | | | | | Basically the same story as the previous commit. But we were already calling _mesa_source_buffer_exists() in ReadPixels(). Yeah, we were calling it twice. Signed-off-by: Brian Paul <[email protected]>
* mesa: remove redundant format/type checks in glReadPixels()Brian Paul2012-02-071-35/+0
| | | | | | These are done in _mesa_error_check_format_and_type(). Signed-off-by: Brian Paul <[email protected]>
* mesa: new _mesa_error_check_format_and_type() functionBrian Paul2012-02-071-4/+5
| | | | | | | | | | | | | | | | | | | | 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: remove byteswap check in fast_read_rgba_pixels_memcpy()Brian Paul2012-01-271-5/+0
| | | | | | It's handled by _mesa_format_matches_format_and_type() now. Reviewed-by: Ian Romanick <[email protected]>
* mesa: added swapBytes parameter to _mesa_format_matches_format_and_type()Brian Paul2012-01-271-1/+2
| | | | | | Not actually used yet though. Reviewed-by: Ian Romanick <[email protected]>
* mesa: remove LSB-first pixel packing check in glReadPixelsBrian Paul2012-01-271-2/+1
| | | | | | GL_UNPACK_LSB_FIRST only applies to bitmap data, not glReadPixels. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Throw the required error for glReadPixels() from a multisampled FBO.Eric Anholt2012-01-121-0/+5
| | | | | | | Fixes piglit EXT_framebuffer_multisample-negative-readpixels. Reviewed-by: Brian Paul <[email protected]> NOTE: This is a candidate for the 8.0 branch.
* mesa: rename _mesa_unpack_int_rgba_row() to _mesa_unpack_uint_rgba_row()Brian Paul2012-01-091-1/+1
| | | | | | Since it returns uint values, not int. Reviewed-by: Eric Anholt <[email protected]>
* mesa: use malloc instead of MAX_WIDTH array in glReadPixels()Brian Paul2011-12-081-9/+14
| | | | | Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Make formats.c "datatype" values match glGetTexLevelParameter return.Eric Anholt2011-11-221-2/+2
| | | | | | | | | | | | | | | | | The formats.c code's "datatype" value is "what does this value mean", i.e. unorm or snorm or float, and is the return value from the GL_TEXTURE_RED_TYPE class of queries. The depth formats were marked as GL_UNSIGNED_INT, which is what we use for integer, and not what we should be returning from the glGetTexLevelParameter. In texstore, we were inappropriately using it as an argument to _mesa_unpack_depth_span() that was expecting a value like GL_UNSIGNED_INT or GL_UNSIGNED_SHORT. Just hardcode _mesa_unpack_depth_span()'s arguments for now, though it looks like the consumers of that interface would be happier with using MESA_FORMAT. Reviewed-by: Brian Paul <[email protected]>
* mesa: handle MapRenderbuffer() failures in glReadPixelsBrian Paul2011-11-191-0/+45
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: make slow_read_rgba_pixels() a void functionBrian Paul2011-11-191-3/+1
| | | | | | The boolean return value was ignored by the caller. Reviewed-by: Kenneth Graunke <[email protected]>
* Revert "read_rgba_pixels: Don't force clamping if the renderbuffer is ↵Michel Dänzer2011-11-171-2/+1
| | | | | | | | normalized." This reverts commit b11c16752a18ef8dfb96d9f0ead6ecb62bde6773. Breaks at least luminance destination formats.
* read_rgba_pixels: Don't force clamping if the renderbuffer is normalized.Michel Dänzer2011-11-171-1/+2
| | | | | Signed-off-by: Michel Dänzer <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: initialize stencilMap, Stride if stencilRb==depthRbBrian Paul2011-11-161-0/+4
|
* mesa: don't map depth+stencil buffer twice in glReadPixels()Brian Paul2011-11-161-3/+11
| | | | | | | | | | | In slow_read_depth_stencil_pixels_separate() we might have separate depth and stencil buffers or a combined buffer. In the later case, don't map the buffer twice. This function is used when the depth scale/bias pixel transfer values are not the defaults. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=42963 Reviewed-by: José Fonseca <[email protected]>
* mesa: move swrast ReadPixels code into core MesaBrian Paul2011-11-151-0/+484
| | | | | | | | The swrast ReadPixels code has no dependencies on swrast since moving to Map/UnmapRenderbuffer(). We'll be able to remove s_readpix.c and remove the state tracker's glReadPixels code next. Acked-by: Eric Anholt <[email protected]>