summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/pack.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Fix regression introduced by commit "mesa: fix packing of float texels ↵Pavel Popov2014-07-181-8/+8
| | | | | | | | | | | | | | | to GL_SHORT/GL_BYTE". This commit "mesa: fix packing of float texels to GL_SHORT/GL_BYTE" replaced *_TO_BYTE to *_TO_BYTE_TEX because *_TO_FLOAT_TEX are used to unpack the texels to floats. In this case *_TO_FLOATZ in function extract_float_rgba also should be replaced to *_TO_FLOAT_TEX. Underline that these macros automatically preserve zero when converting. The regression was observed on 3 oglconform tests: snorm-textures basic.getTexImage snorm-textures advanced.mipmap.manual.getTex snorm-textures advanced.mipmap.upload.getTex Signed-off-by: Pavel Popov <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
* Remove the ATI_envmap_bumpmap extensionJason Ekstrand2014-06-301-137/+0
| | | | | | | | | | | As far as I can tell, the Intel mesa driver is the only driver in the world still supporting this legacy extension. If someone wants to do bump mapping, they can use shaders. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> [v1] Reviewed-by: Chris Forbes <[email protected]> [v2] Reviewed-by: Ian Romanick <[email protected]> [v3]
* mesa: fix packing of float texels to GL_SHORT/GL_BYTEChris Forbes2014-04-101-58/+58
| | | | | | | | | | | | | | | | | Previously, we would unpack the texels to floats using *_TO_FLOAT_TEX, and then pack them into the desired format using FLOAT_TO_*. Unfortunately, this isn't quite the inverse operation, and so some texel values would end up off-by-one. This fixes the GL_RGB8_SNORM and GL_RGB16_SNORM subcases in piglit's arb_texture_view-format-consistency-get test on i965. The similar 1-, 2- and 4-component cases already worked because they took the memcpy path rather than repacking. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Eric Anholt <[email protected]>
* mesa: fix GetTexImage if mesa format and internal format don't matchMarek Olšák2013-02-111-0/+26
| | | | | | | | Tested with softpipe only exposing RGBA formats. NOTE: This is a candidate for the stable branches. Reviewed-by: Brian Paul <[email protected]>
* ReadPixels: Force ALPHA to 1 while rebasing RGBA values for GL_RGB formatCarl Worth2013-01-231-0/+10
| | | | | | | | | | | | | | | | | | | | | | When performing a ReadPixels operation, we may be reading from a buffer that stores alpha values, but that is actually representing a buffer with no alpha channel. In this case, while rebasing the values, touch up all alpha values read to 1.0. This commit fixes the following piglit (sub) tests: ARB_texture_float/fbo-colormask-formats GL_RBG16F_ARB EXT_texture_snorm/fbo-colormask-formats GL_RGB16_SNORM GL_RGB8_SNORM GL_RGB_SNORM It likely improves the results of other tests as well, but a PASS remains elusive due to additional bugs. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* pack: handle GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV caseJordan Justen2013-01-141-2/+10
| | | | | | | | For floats, if GL_RGB is the source, then alpha should be set to 1.0F. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Use MIN instead of CLAMP for unsigned source dataIan Romanick2012-10-241-108/+108
| | | | | | | | | | This silences a zillion GCC warnings like: ../../../src/mesa/main/pack.c: In function '_mesa_pack_rgba_span_from_uints': ../../../src/mesa/main/pack.c:560:13: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* Don't cast the return value of malloc/reallocMatt Turner2012-09-051-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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: add cast to silence warning in _mesa_pack_rgba_span_from_ints()Brian Paul2012-08-161-1/+1
|
* mesa pack: handle packed integer formats with clampingJordan Justen2012-08-141-10/+619
| | | | | Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa pack: handle uint and int clamping properlyJordan Justen2012-08-141-7/+99
| | | | | | | | | | | 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: Use GLdouble for depthMax in final unpack conversions.Kenneth Graunke2012-08-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | The final step of _mesa_unpack_depth_span is to take the temporary GLfloat depth values and convert them to the desired format. When converting to GL_UNSIGNED_INTEGER with depthMax > 0xffffff, we use double-precision math to avoid overflow and precision problems. Or at least that's the idea. Unfortunately GLdouble z = depthValues[i] * (GLfloat) depthMax; actually causes single-precision multiplication, since both operands are GLfloats. Casting depthMax to GLdouble causes the scaling to be done with double-precision math. Fixes a regression in oglconform's depth-stencil basic.read.ds test since c60ac7b17993d28af65b04f9bbbf3ee74c35358c, where the expected and actual values differed slightly. For example, 0xcfa7a6 vs. 0xcfa7a4. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49772 Signed-off-by: Kenneth Graunke <[email protected]>
* mesa pack: use _mesa_problem instead of assertJordan Justen2012-07-211-7/+10
| | | | | | | | If the pack type is not supported, use _mesa_problem rather than asserting. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: add glformats integer type/format detection routinesJordan Justen2012-07-211-4/+5
| | | | | | | | | | | | _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: disable MSVC global optimization in pack.cJosé Fonseca2012-07-201-0/+13
| | | | | | | | To reduce excessive compilation time in release mode. NOTE: This is a candidate for the 8.0 branch. Tested-by: Brian Paul <[email protected]>
* mesa: use F_TO_I() instead of IROUND()Brian Paul2012-05-191-110/+110
| | | | | | | | Use it where performance matters more and the exact method of float->int conversion/rounding isn't terribly important. There should no net change here since F_TO_I() is the new name of the old IROUND() function. Reviewed-by: José Fonseca <[email protected]>
* mesa: add _mesa_rebase_rgba_float/uint() functionsBrian Paul2012-03-081-0/+91
| | | | | | | | | These will be used by glReadPixels() and glGetTexImage() to fix issues with reading GL_LUMINANCE and other formats. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: José Fonseca <[email protected]>
* mesa: Fix copy-and-paste error in _mesa_pack_rgba_span_floatIan Romanick2012-02-021-3/+2
| | | | | | | | | | | GL_RG_INTEGER only has two components, not three. I'll be surprised if anyone ever tries to glReadPixels(..., GL_SHORT, GL_RG_INTEGER, ...). This was found by inspection. NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: remove redundant byte swap checkBrian Paul2012-01-271-6/+2
| | | | | | The outer conditional already did the test. Reviewed-by: Ian Romanick <[email protected]>
* mesa: When unpacking signed integer pixel data, don't clamp to 0.Eric Anholt2012-01-271-33/+12
| | | | | | | | | | | | In the core, we always treat spans of int/uint data as uint, so this extract function was truncating storage of integer pixel data to a n int texture to (0, max_int) instead of (min_int, max_int). There is probably missing code for handling truncation on conversion between pixel formats, still, but this does improve things. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: Brian Paul <[email protected]>
* mesa: Add clamping for packing of integer data.Eric Anholt2012-01-271-4/+4
| | | | | | | | | | Mostly fixes piglit EXT_texture_integer/getteximage-clamping. The remaining failure involves precision loss on storing of int32 texture data (something I knew was an issue, but wasn't trying to test). NOTE: This is a candidate for the 8.0 branch. Reviewed-by: Brian Paul <[email protected]>
* mesa: Add the remaining from/to types for GL_EXT_texture_integer (and R/RG).Eric Anholt2012-01-241-51/+61
| | | | | | | | | | | This aborts and crashes in intel oglconform's int-textures into being just rendering failures. Clamping isn't handled yet. v2: Add missing "break". v3: Drop the int/uint distinction, since they don't need different clamping. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: Brian Paul <[email protected]> (v2)
* mesa: Add missing GL_RG_INTEGER casesIan Romanick2012-01-041-0/+39
| | | | | | | | Adds two missing '|| srcFormat == GL_RG_INTEGER' in assertions and a bunch of missing pixel converions cases. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[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: remove unreachable code in _mesa_unpack_color_span_ubyte()Brian Paul2011-12-021-64/+0
| | | | | | | | We checked if srcType == GL_UNSIGNED_BYTE earlier so there was no way to reach this code. This was left-over code from the GLchan removal work. Reviewed-by: José Fonseca <[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]>
* pack: fix indentation (trivial)Dave Airlie2011-11-271-1/+1
| | | | | | just saw this while looking for other problems. Signed-off-by: Dave Airlie <[email protected]>
* mesa: new BYTE/SHORT_TO_FLOATZ() macrosBrian Paul2011-11-151-26/+10
| | | | | | | 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-4/+1
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa: replace GLstencil with GLubyteBrian Paul2011-11-151-16/+7
|
* mesa: Fix memory leak in out-of-memory path.Vinson Lee2011-11-011-0/+1
| | | | Fixes Coverity resource leak defect.
* mesa: Fix memory leak in out-of-memory path.Vinson Lee2011-10-241-0/+1
| | | | | | Fixes Coverity resource leak defect. Reviewed-by: Brian Paul <[email protected]>
* mesa: add packing for int/uintDave Airlie2011-10-081-0/+63
| | | | | | | This just adds a simple packing for GL_UNSIGNED_INT/GL_INT destination formats. This is enough for at least the gallium drivers to pack both unsigned and signed types for read pixels. Signed-off-by: Dave Airlie <[email protected]>
* mesa: s/INLINE/inline/Brian Paul2011-10-011-5/+5
| | | | | | | INLINE is still seen in some files (some generated files, etc) but this is a good start. Acked-by: Kenneth Graunke <[email protected]>
* mesa: convert _mesa_unpack_color_span_chan() to ubyteBrian Paul2011-09-201-50/+48
|
* mesa/pack: don't apply transfer operations to integer format buffers. (v3)Dave Airlie2011-09-131-0/+23
| | | | | | | | | | | | | | | | | The EXT_texture_integer issues says: Should pixel transfer operations be defined for the integer pixel path? RESOLVED: No. Fragment shaders can achieve similar results with more flexibility. There is no need to aggrandize this legacy mechanism. v2: fix comments, fix unpack paths, use same comment/code v3: fix last comment Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Remove support for unpacking from client memory to color-index pixelsIan Romanick2011-09-061-40/+12
| | | | | | | Mesa hasn't supported color-index rendering for a long time. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: implement packing of DEPTH_STENCIL & FLOAT_32_UNSIGNED_INT_24_8_REV comboMarek Olšák2011-07-111-5/+16
| | | | Tested with the new piglit fbo-depthstencil test.
* mesa: implement depth unpacking for GL_FLOAT_32_UNSIGNED_INT_24_8_REVMarek Olšák2011-07-101-2/+25
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: implement stencil unpacking for GL_FLOAT_32_UNSIGNED_INT_24_8_REVMarek Olšák2011-07-101-3/+32
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: don't allocate memory in _mesa_unpack_depth_span if we don't need itMarek Olšák2011-06-241-7/+7
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: fix a memory leak in _mesa_unpack_depth_spanMarek Olšák2011-06-241-0/+1
| | | | | | NOTE: This is a candidate for the 7.10 branch. Reviewed-by: Brian Paul <[email protected]>
* mesa: remove unused-but-set variable in extract_uint_rgbaMarek Olšák2011-05-011-3/+0
|
* mesa: implement EXT_packed_floatMarek Olšák2011-04-291-5/+76
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa, util: move RGB9E5 conversion functions to gallium/utilMarek Olšák2011-04-291-1/+1
| | | | | | | Also use MAX3 and incorporate Ian's suggestion in texformat.c. I don't think wrapping u_format_rgb9e5.h in another header and thus making it more complicated is worth it.
* mesa: implement EXT_texture_shared_exponentMarek Olšák2011-04-291-5/+77
| | | | | | | | | swrast support done. There is no renderbuffer support in swrast, because it's not required by the extension. Reviewed-by: Brian Paul <[email protected]>
* main: remove duplicated includesNicolas Kaiser2011-04-251-1/+0
| | | | | | | Remove duplicated includes of guarded headers. Signed-off-by: Nicolas Kaiser <[email protected]> Signed-off-by: Brian Paul <[email protected]>
* mesa: Fix _mesa_unpack_dudv_span_byte assertion.Eric Anholt2011-04-171-1/+2
| | | | | | | It was accepting only GL_DUDV_ATI and not the specific sized format GL_DU8DV8_ATI. Fixes assertion failure at startup in Shadowgrounds. Reviewed-by: Brian Paul <[email protected]>
* mesa: implement clamping controls (ARB_color_buffer_float)Marek Olšák2011-03-291-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashed commit of the following: Author: Marek Olšák <[email protected]> mesa: fix getteximage so that it doesn't clamp values mesa: update the compute_version function mesa: add display list support for ARB_color_buffer_float mesa: fix glGet query with GL_ALPHA_TEST_REF and ARB_color_buffer_float commit b2f6ddf907935b2594d2831ddab38cf57a1729ce Author: Luca Barbieri <[email protected]> Date: Tue Aug 31 16:50:57 2010 +0200 mesa: document known possible deviations from ARB_color_buffer_float commit 5458935be800c1b19d1c9d1569dc4fa30a97e8b8 Author: Luca Barbieri <[email protected]> Date: Tue Aug 24 21:54:56 2010 +0200 mesa: expose GL_ARB_color_buffer_float commit aef5c3c6be6edd076e955e37c80905bc447f8a82 Author: Luca Barbieri <[email protected]> Date: Thu Aug 26 18:12:34 2010 +0200 mesa, mesa/st: handle read color clamping properly (I'll squash the st/mesa part to a separate commit. -Marek) We set IMAGE_CLAMP_BIT in the caller based on _ClampReadColor, where the operation mandates it. TODO: did I get the set of operations mandating it right? commit 3a9cb5e59b676b6148c50907ce6eef5441677e36 Author: Luca Barbieri <[email protected]> Date: Thu Aug 26 18:09:41 2010 +0200 mesa: respect color clamping in texenv programs (v2) Changes in v2: - Fix attributes other than vertex color sometimes getting clamped commit de26f9e47e886e176aab6e5a2c3d4481efb64362 Author: Luca Barbieri <[email protected]> Date: Thu Aug 26 18:05:53 2010 +0200 mesa: restore color clamps on glPopAttrib commit a55ac3c300c189616627c05d924c40a8b55bfafa Author: Luca Barbieri <[email protected]> Date: Thu Aug 26 18:04:26 2010 +0200 mesa: clamp color queries if and only if fragment clamping is enabled commit 9940a3e31c2fb76cc3d28b15ea78dde369825107 Author: Luca Barbieri <[email protected]> Date: Wed Aug 25 00:00:16 2010 +0200 mesa: introduce derived _ClampXxxColor state resolving FIXED_ONLY To do this, we make ClampColor call FLUSH_VERTICES with the appropriate _NEW flag. We introduce _NEW_FRAG_CLAMP since fragment clamping has wide-ranging effects, despite being in the Color attrib group. This may be easily changed by s/_NEW_FRAG_CLAMP/_NEW_COLOR/g commit 6244c446e3beed5473b4e811d10787e4019f59d6 Author: Luca Barbieri <[email protected]> Date: Thu Aug 26 17:58:24 2010 +0200 mesa: add unclamped color parameters
* mesa: Include mtypes.h in files that use gl_context struct.Vinson Lee2011-01-051-0/+1
| | | | | | Directly include mtypes.h if a file uses a gl_context struct. This allows future removal of headers that are not strictly necessary but indirectly include mtypes.h for a file.