summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texcompress_rgtc.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Fix texture compression on big-endian systemsUlrich Weigand2015-09-171-2/+4
| | | | | | | | | | | | | | | | | | | | | | | Various pieces of code to create compressed textures will first generate an uncompressed RGBA texture into a temporary buffer, and then read from that buffer while creating the final compressed texture in the requested format. The code reading from the temporary buffer assumes the buffer is formatted as an array of bytes in RGBA order. However, the buffer is filled using a _mesa_texstore call with MESA_FORMAT_R8G8B8A8_UNORM format -- this is defined as an array of *integers* holding the RGBA values in packed format (least-significant to most-significant). This means incorrect bytes are accessed on big-endian systems. This patch fixes this by using the MESA_FORMAT_A8B8G8R8_UNORM format instead on big-endian systems when filling the buffer. This fixes about 100 piglit test case failures on s390x for me. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com> Tested-by: Oded Gabbay <oded.gabbay@gmail.com> Cc: "10.6" "11.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Dave Airlie <airlied@gmail.com>
* mesa: remove unneeded #include of colormac.hBrian Paul2015-04-011-1/+0
| | | | | Acked-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Mark Janes <mark.a.janes@intel.com>
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-231-4/+4
| | | | Acked-by: Eric Anholt <eric@anholt.net>
* mesa: Remove _mesa_make_temp_float_imageIago Toral Quiroga2015-01-121-14/+31
| | | | | | | | | | 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 <jason.ekstrand@intel.com>
* mesa: Remove _mesa_make_temp_ubyte_imageIago Toral Quiroga2015-01-121-14/+31
| | | | | | | | | | | | 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 <jason.ekstrand@intel.com>
* util: move shared rgtc code to util (v2)Dave Airlie2014-09-171-60/+19
| | | | | | | | | | | This was being shared using a ../../ get out of gallium into mesa, and I swore when I did it I'd fix things when we got a util dir, we did, so I have. v2: move RGTC_DEBUG define Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* mesa: Fix Type A _INT formats to MESA_FORMAT naming standardMark Mueller2014-01-271-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | Replace Type A _INT formats names with _SINT to match naming spec, and update type C formats as follows: s/MESA_FORMAT_R_INT8\b/MESA_FORMAT_R_SINT8/g s/MESA_FORMAT_R_INT16\b/MESA_FORMAT_R_SINT16/g s/MESA_FORMAT_R_INT32\b/MESA_FORMAT_R_SINT32/g s/MESA_FORMAT_RG_INT8\b/MESA_FORMAT_RG_SINT8/g s/MESA_FORMAT_RG_INT16\b/MESA_FORMAT_RG_SINT16/g s/MESA_FORMAT_RG_INT32\b/MESA_FORMAT_RG_SINT32/g s/MESA_FORMAT_RGB_INT8\b/MESA_FORMAT_RGB_SINT8/g s/MESA_FORMAT_RGB_INT16\b/MESA_FORMAT_RGB_SINT16/g s/MESA_FORMAT_RGB_INT32\b/MESA_FORMAT_RGB_SINT32/g s/MESA_FORMAT_RGBA_INT8\b/MESA_FORMAT_RGBA_SINT8/g s/MESA_FORMAT_RGBA_INT16\b/MESA_FORMAT_RGBA_SINT16/g s/MESA_FORMAT_RGBA_INT32\b/MESA_FORMAT_RGBA_SINT32/g s/\bMESA_FORMAT_RED_RGTC1\b/MESA_FORMAT_R_RGTC1_UNORM/g s/\bMESA_FORMAT_SIGNED_RED_RGTC1\b/MESA_FORMAT_R_RGTC1_SNORM/g s/\bMESA_FORMAT_RG_RGTC2\b/MESA_FORMAT_RG_RGTC2_UNORM/g s/\bMESA_FORMAT_SIGNED_RG_RGTC2\b/MESA_FORMAT_RG_RGTC2_SNORM/g s/\bMESA_FORMAT_L_LATC1\b/MESA_FORMAT_L_LATC1_UNORM/g s/\bMESA_FORMAT_SIGNED_L_LATC1\b/MESA_FORMAT_L_LATC1_SNORM/g s/\bMESA_FORMAT_LA_LATC2\b/MESA_FORMAT_LA_LATC2_UNORM/g s/\bMESA_FORMAT_SIGNED_LA_LATC2\b/MESA_FORMAT_LA_LATC2_SNORM/g
* mesa: change gl_format to mesa_formatMark Mueller2014-01-271-1/+1
| | | | s/\bgl_format\b/mesa_format/g. Use better name for Mesa Formats enum
* swrast: Replace ImageOffsets with an ImageSlices pointer.Eric Anholt2013-04-301-42/+28
| | | | | | | | | | | | | This is a step toward allowing drivers to use their normal mapping paths, instead of requiring that all slice mappings come from an aligned offset from the first slice's map. This incidentally fixes missing slice handling in FXT1 swrast. v2: Use slice height helper function. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Brian Paul <brianp@vmware.com>
* 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 <jordan.l.justen@intel.com>
* mesa: fix signed/unsignd mix-up in fetch_signed_l_latc1()Brian Paul2013-01-021-2/+3
| | | | Fixes https://bugs.freedesktop.org/show_bug.cgi?id=58844
* mesa: remove old swrast-based compressed texel fetch codeBrian Paul2012-12-141-132/+0
|
* mesa: add new texel fetch code for rgtc formatsBrian Paul2012-12-141-0/+161
|
* mesa: remove more null pointer checks before free() callsBrian Paul2012-09-031-8/+8
| | | | | Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* mesa/swrast: fix GL_TEXTURE_2D_ARRAY texture fetches for latc/rgtc formatsBrian Paul2012-08-241-40/+60
| | | | | | | Fix-up the texel fetch functions so that they handle 3D coords (as used for array textures) and remove the "f_2d" part from their names. Helps fix swrast crashes in piglit's copyteximage test. More to come.
* swrast: s/Data/Map/ in swrast_texture_imageBrian Paul2012-01-241-12/+12
| | | | To indicate that it points to mapped texture memory.
* mesa: remove the dstX/Y/Zoffset params to _mesa_texstore() functionsBrian Paul2012-01-021-33/+4
| | | | | | | | The were always zero. When doing a sub-texture replacement we account for the dstX/Y/Zoffsets when we map the texture image. So no need to pass them into the texstore code anymore. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: move gl_texture_image::Data, RowStride, ImageOffsets to swrastBrian Paul2011-10-231-12/+12
| | | | | | Only swrast and the drivers that fall back to swrast need these fields now. This removes the last of the fields related to software rendering from gl_texture_image.
* mesa: get rid of imageOffsets arrays in texstore codeBrian Paul2011-10-051-8/+4
| | | | | | | | | | | These were used to find the start of a 3D image slice (or 2D array texture slice) given a base address. Instead, use a simple array of address of image slices instead. This is a step toward getting rid of the gl_texture_image::ImageOffsets field. Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa/gallium: remove GLchan from latc, rgtc codeBrian Paul2011-09-201-14/+14
|
* mesa: s/_mesa_make_temp_chan_image()/_mesa_make_temp_ubyte_image()Brian Paul2011-09-201-4/+4
| | | | Another step toward eliminating the GLchan type.
* mesa: move gl_texture_image::FetchTexel fields to swrastBrian Paul2011-09-171-20/+22
| | | | | This also involves passing swrast_texture_image instead of gl_texture_image into all the fetch functions.
* mesa: fix dstRowDiff computation in RGTC texstore functionsMarek Olšák2011-04-081-4/+4
| | | | | Copied from libtxc_dxtn, this fixes NPOT RGTC1 textures with r300g. I also did the same for RGTC2.
* mesa: add EXT_texture_compression_latcMarek Olšák2011-03-081-4/+64
| | | | | | | | | | | | | | | | | 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.
* rgtc: move the texel fetch into common unsigned/signed code.Dave Airlie2011-03-021-65/+12
| | | | | | This function can be done in the include file also. Signed-off-by: Dave Airlie <airlied@redhat.com>
* rgtc: fix issues with compressor and signed types.Dave Airlie2011-03-021-3/+3
| | | | | | | | | | With signed types we weren't hitting this test however the comment stating this doesn't happen often doesn't apply when using signed types since an all 0 block is quite common which isn't abs min or max. this fixes the limits correctly again also. Signed-off-by: Dave Airlie <airlied@redhat.com>
* rgtc: don't try to access off the end of the block.Dave Airlie2011-03-021-2/+2
| | | | | | | | if the values are all in the last dword, the high bits can be 0, This fixes a valgrind warning I saw when playing with mipmaps. Signed-off-by: Dave Airlie <airlied@redhat.com>
* rgtc: move to using ubyte for fetch instead of chan + fix limitDave Airlie2011-03-021-13/+13
| | | | | | My previous fix to the byte max was incorrect. Signed-off-by: Dave Airlie <airlied@redhat.com>
* rgtc: fix fetch function limits for signed typesDave Airlie2011-03-021-2/+2
|
* swrast/rgtc: fix rendering issues introduced when fix constantsDave Airlie2011-03-021-1/+1
| | | | The max value was wrong and this showed up in the piglit tests.
* rgtc: shared the compressor code between signed/unsignedDave Airlie2011-03-011-696/+27
| | | | | | | | No idea why I didn't do it like this the first time, but share the code like other portions of mesa do using _tmp.h suffix and some #defines for the types. Signed-off-by: Dave Airlie <airlied@redhat.com>
* rgtc: fix void pointer arith.Dave Airlie2011-03-011-2/+2
| | | | should fix scons build.
* mesa: Add RGTC texture store/fetch support.Dave Airlie2011-02-281-0/+1122
This adds support for the RGTC unsigned and signed texture storage and fetch methods. the code is a port of the DXT5 alpha compression code. Signed-off-by: Dave Airlie <airlied@redhat.com>