summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_texture.c
Commit message (Collapse)AuthorAgeFilesLines
* swrast: move texture_slices() calls out of loopsBrian Paul2014-04-241-4/+8
| | | | Reviewed-by: José Fonseca <[email protected]>
* swrast: move null pointer check earlier in _swrast_map_teximage()Brian Paul2014-04-241-6/+9
| | | | | | | There's no reason to compute texel size, stride, etc. if there's no image data to map. Reviewed-by: José Fonseca <[email protected]>
* swrast: remove _mesa_ prefix from static functionBrian Paul2014-04-241-3/+3
| | | | | | And add a const qualifier. Reviewed-by: José Fonseca <[email protected]>
* swrast: allocate swrast_texture_image::ImageSlices array if neededBrian Paul2014-04-241-0/+10
| | | | | | | | | | | Fixes a segmentation fault in conform divzero.c test. This happens when glTexImage(level, width=0, height=0) is called. We don't allocate texture memory in that case so the ImageSlices array was never allocated. Cc: "10.1" <[email protected]> Reviewed-by: José Fonseca <[email protected]>
* mesa: modified _mesa_align_free() to accept NULL pointerSiavash Eliasi2013-12-041-4/+3
| | | | | | | | | | | So that it acts like ordinary free(). This lets us remove a bunch of if statements where the function is called. v2: - Avoiding compile error on MSVC and possible warnings on other compilers. - Added comment regards passing NULL pointer being safe. Reviewed-by: Brian Paul <[email protected]>
* swrast: Always use MapTextureImage for mapping textures for swrast.Eric Anholt2013-04-301-10/+48
| | | | | | | | | | | | | | | Now that everything goes through ImageSlices[], we can rely on the driver's existing texture mapping function. A big block of code goes away on Radeon that looks like it was to deal with the validate that happened at SpanRenderStart, which no longer occurs since we don't need validation for the MapTextureImage hook. v2: Rewrite comment about ImageSlices, fix duplicated swImages, touch up unmap loop. Reviewed-by: Kenneth Graunke <[email protected]> (v1) Reviewed-by: Brian Paul <[email protected]>
* swrast: Make a teximage's stored RowStride be in terms of bytes per row.Eric Anholt2013-04-301-1/+2
| | | | | | | | | | | | | For hardware drivers with pitch alignment requirements, a non-power-of-two-sized texture format won't end up being an integer number of pixels per row. Also, avoids having to change our units between MapTextureImage's rowStride and swrast's RowStride. This doesn't fully convert the compressed texel fetch path, but does make sure we don't drop any bits (not that we'd expect to). Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* swrast: Replace ImageOffsets with an ImageSlices pointer.Eric Anholt2013-04-301-21/+22
| | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* swrast: Move ImageOffsets allocation to shared code.Eric Anholt2013-04-301-12/+12
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* swrast: Clean up and explain the mapping process.Eric Anholt2013-04-301-10/+14
| | | | | | | v2: Move slice height calculation to a helper function (recommeded by Brian). Reviewed-by: Kenneth Graunke <[email protected]> (v1) Reviewed-by: Brian Paul <[email protected]>
* swrast: Factor out texture slice counting.Eric Anholt2013-04-301-4/+12
| | | | | | | This function going to get used a lot more in upcoming patches. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-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: Generalize TexStorage allocator between swrast and intel.Eric Anholt2013-04-211-27/+0
| | | | | | | | | | This should be reusable for other non-gallium drivers, so we can make the extension always be available. v2: Add a more detailed comment than the old function had (recommended by Brian). Reviewed-by: Brian Paul <[email protected]> (v1)
* Remove useless checks for NULL before freeingMatt Turner2012-09-051-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has been generated by the following Coccinelle semantic patch: // Remove useless checks for NULL before freeing // // free (NULL) is a no-op, so there is no need to avoid it @@ expression E; @@ + free (E); + E = NULL; - if (unlikely (E != NULL)) { - free(E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; type T; @@ + free ((T) E); + E = NULL; - if (unlikely (E != NULL)) { - free((T) E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; @@ + free (E); - if (unlikely (E != NULL)) { - free (E); - } @@ expression E; type T; @@ + free ((T) E); - if (unlikely (E != NULL)) { - free ((T) E); - } Reviewed-by: Brian Paul <[email protected]>
* Don't cast the return value of malloc/reallocMatt Turner2012-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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: new _mesa_num_tex_faces() helperBrian Paul2012-08-241-2/+3
| | | | | Not a real big help now, but will be useful for the GL_ARB_texture_cube_map_array extension in the future.
* mesa: Remove unnecessary parameters from AllocTextureImageBufferPauli Nieminen2012-08-121-24/+13
| | | | | | | | | | Size and format information is always stored in gl_texture_image structure. That makes it preferable to remove duplicate information from parameters to make interface easier to understand. Signed-off-by: Pauli Nieminen <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i915: Initialize swrast_texture_image structure fields.Paul Berry2012-02-221-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit 980f6f1 (mesa: move gl_texture_image::Width/Height/DepthScale fields to swrast) moved the initialization of the Width, Height, and DepthScale fields to _swrast_alloc_texture_image_buffer(). However, i915 doesn't call this function because it performs its own buffer allocation. As a result, the Width, Height, and DepthScale fields weren't getting initialized properly, and some operations requiring swrast would fail. This patch ensures that Width, Height, and DepthScale are properly initialized by separating the code that sets them into a new function, _swrast_init_texture_image(), which is called by intel_alloc_texture_image_buffer() as well as _swrast_alloc_texture_image_buffer(). It also moves the initialization of _IsPowerOfTwo into this function. Fixes piglit test fbo/fbo-cubemap on i915. Partially fixes https://bugs.freedesktop.org/show_bug.cgi?id=41216 This is a candidate for the 8.0 branch. Reviewed-and-tested-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* swrast: move some renderbuffer functions to s_renderbuffer.cBrian Paul2012-01-241-121/+0
|
* swrast: use swrast_renderbuffer instead of gl_renderbufferBrian Paul2012-01-241-9/+11
|
* mesa: remove gl_renderbuffer:RowStride fieldBrian Paul2012-01-241-1/+0
|
* swrast: stop using Put/GetRow/Values() in swrast codeBrian Paul2012-01-241-7/+1
| | | | | All color buffer rendering is now done by accessing mapped renderbuffer memory. We're now able to get rid of all the GetRow/PutRow stuff.
* mesa: use gl_renderbuffer::Map for all depth/stencil accessesBrian Paul2012-01-241-34/+107
| | | | | Instead of using the obsolete gl_renderbuffer::Data field. Color buffer are still accessed through GetRow/PutRow().
* swrast: s/Data/Map/ in swrast_texture_imageBrian Paul2012-01-241-4/+4
| | | | To indicate that it points to mapped texture memory.
* mesa: remove _mesa_ffs(), implement ffs() for non-GNU platformsBrian Paul2012-01-121-2/+2
| | | | | | | | | | | Call ffs() and ffsll() everywhere. Define our own ffs(), ffsll() functions when the platform doesn't have them. v2: remove #ifdef _WIN32, __IBMC__, __IBMCPP_ tests inside ffs() implementation. The #else clause was recursive. Reviewed-by: Kenneth Graunke <[email protected]> Tested-by: Alexander von Gluck <[email protected]>
* swrast: assert _swrast_map_teximage() x, y is multiple of block sizeBrian Paul2011-12-261-0/+3
|
* swrast: replace assertion with conditional in _swrast_map_teximage()Brian Paul2011-12-261-2/+6
| | | | | Just in case we ran out of memory when trying to allocate the texture memory.
* swrast: remove bogus assertionBrian Paul2011-11-111-1/+0
| | | | | It would fail for images that were never allocated (and wouldn't be used during rendering).
* swrast: implement GL_ARB_texture_storageBrian Paul2011-10-311-0/+32
|
* swrast: use _mesa_ffs() instead of ffs()Brian Paul2011-10-251-2/+2
| | | | Fixes MSVC build.
* mesa: add swrast_texture_image::BufferBrian Paul2011-10-231-8/+143
| | | | | | | | | | | | | | | In the past, swrast_texture_image::Data has been overloaded. It could either point to malloc'd memory storing texture data, or it could point to a current mapping of GPU memory. Now, Buffer always points to malloc'd memory (if we're not using GPU memory) and Data always points to mapped memory. The next step would be to rename Data -> Map. This change also involves adding swrast functions for mapping textures and renderbuffers prior to rendering to setup the Data pointer. Plus, corresponding functions to unmap texures and renderbuffers. This is very much like similar code in the dri drivers.
* mesa: move gl_texture_image::Data, RowStride, ImageOffsets to swrastBrian Paul2011-10-231-8/+32
| | | | | | 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.
* swrast: When asked to map a slice of a 1D array, give back that slice.Eric Anholt2011-10-031-0/+7
| | | | | | | | | Until now, we've been treating 1D arrays as a single slice, and each array slice is actually just a row of the 2D texture. While swrast still stores them this way, hardware drivers think that 1D arrays have actual separate slices not stored as contiguous rows. Reviewed-by: Brian Paul <[email protected]>
* mesa: remove support for GL_APPLE_client_storage extensionBrian Paul2011-09-221-1/+1
| | | | | | | AFAIK, there are few users of this extension and I can see a couple reasons why this is probably broken in Mesa anyway. Reviewed-by: Ian Romanick <[email protected]>
* mesa: move gl_texture_image::Width/Height/DepthScale fields to swrastBrian Paul2011-09-221-0/+13
| | | | | | | These fields were only used for swrast so move them into swrast_texture_image. Reviewed-by: Ian Romanick <[email protected]>
* mesa: move gl_texture_image::_IsPowerOfTwo into swrastBrian Paul2011-09-221-0/+8
| | | | | | It's only used by swrast. Reviewed-by: Ian Romanick <[email protected]>
* swrast: add Alloc/FreeTextureImageBuffer() driver functionsBrian Paul2011-09-171-0/+38
| | | | | Not called yet. These will replace the core Mesa functions for allocating and freeing malloc'd texture memory.
* swrast: introduce new swrast_texture_image structBrian Paul2011-09-171-0/+27
| | | | | No subclass fields yet. Subsequent patches will add the fields related to software rendering that are currently in gl_texture_image.
* swrast: Add implementation of MapTextureImage/UnmapTextureImage.Brian Paul2011-08-291-0/+109
| | | | Reviewed-by: Brian Paul <[email protected]>
* Split the s_texture.c file into two new files:Brian Paul2005-09-151-3958/+0
| | | | | s_texcombine.c - for texture combining/application s_texfilter.c - for texture sampling/filtering
* minor clean-up of texture_combine()Brian Paul2005-09-061-12/+9
|
* don't use DEFARRAY/CHECKARRAY stuffBrian Paul2005-09-061-3/+1
|
* also check for texture border in sample_linear_2d()Brian Paul2005-08-251-2/+3
|
* Redo all the GL_LINEAR interpolation code in terms of LERP macros/functions.Brian Paul2005-06-301-208/+236
| | | | This cleans up and simplifies the arithmetic quite a bit.
* Fix some warningsAlan Hourihane2004-12-021-5/+0
|
* tweak texcoord for sampling texture rectangles (Dave Reveman)Brian Paul2004-09-131-22/+13
|
* Silence gcc 3.4 warnings on ReactOS. Mostly unused var warnings. (patch ↵Brian Paul2004-08-251-1/+29
| | | | 1015696)
* fix minor typo in commentBrian Paul2004-06-111-1/+1
|
* Check for NULL texture object when choosing texture sampler. Fixes segfault ↵Brian Paul2004-06-021-92/+98
| | | | when fragment program references an incomplete texture