aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/mipmap.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: make _mesa_prepare_mipmap_level() staticBrian Paul2016-03-291-8/+8
| | | | | | | | | No longer called from any other file. Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Tested-by: Ian Romanick <[email protected]>
* mesa: new _mesa_prepare_mipmap_levels() function for mipmap generationBrian Paul2016-03-291-31/+57
| | | | | | | | | | | | Simplifies the loops in generate_mipmap_uncompressed() and generate_mipmap_compressed(). Will be used in the state tracker too. Could probably be used in the meta code. If so, some additional clean-ups can be done after that. v2: use unsigned types instead of GLuint, per Ian Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: simplify some code with new _mesa_cube_face_target() functionBrian Paul2016-02-121-6/+1
| | | | | Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: remove _ARB suffix from cube map enumsBrian Paul2016-02-121-7/+7
| | | | | | | Just minor clean-up so we're consistent everywhere. Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: move half<->float convertion to utilRob Clark2015-10-161-0/+1
| | | | | | | | Needed in NIR too, so move out of mesa/main/imports.c Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Rob Clark <[email protected]>
* mesa: fix mipmap generation for immutable, compressed texturesRoland Scheidegger2015-09-251-21/+15
| | | | | | | | | | | | | | | | | | | | | If the immutable compressed texture didn't have the full mip pyramid, this didn't work, because it tried to generate mip levels for non-existing levels. _mesa_prepare_mipmap_level() would correctly handle this by returning FALSE if the mip level didn't exist, however we actually created the non-existing mip level right before that because we used _mesa_get_tex_image() before calling _mesa_prepare_mipmap_level(). It would then proceed to crash (we allocated the mip level, which is a bad idea on an immutable texture, but didn't initialize the values, leading to assertion failures or segfaults). Fix this by using _mesa_select_tex_image() instead and call it after _mesa_prepare_mipmap_level(), as that function will allocate missing mip levels for non-immutable textures already. This fixes a (2 year old) crash with astromenace which was hack-fixed in ubuntu packages instead: http://bugs.debian.org/718680 (I guess most apps do full mip chains - I believe this app not doing it is actually unintentional, always one level less than full mip chain...). Cc: "10.6 11.0" <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa/formats: only do type and component lookup for uncompressed formatsNanley Chery2015-08-241-1/+1
| | | | | | | | | | | | Only uncompressed formats have a non-void type and actual components per pixel. Rename _mesa_format_to_type_and_comps to _mesa_uncompressed_format_to_type_and_comps and require callers to check if the format is not compressed. v2. include compressed format cases to avoid gcc warnings (Chad). Reviewed-by: Chad Versace <[email protected]> Signed-off-by: Nanley Chery <[email protected]>
* mesa: replace Driver.GetTexImage with GetTexSubImage()Brian Paul2015-07-211-3/+6
| | | | | | | | | | | | | | | The new driver hook has x/y/zoffset and width/height/depth parameters for the new glGetTextureSubImage() function. The meta code and gallium state tracker are updated to handle the new parameters. Callers to Driver.GetTexSubImage() pass in offsets=0 and sizes equal to the whole texture size. v2: update i965 driver code, s/GLint/GLsizei/ in GetTexSubImage hook Reviewed-by: Ilia Mirkin <[email protected]>
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-231-10/+10
| | | | Acked-by: Eric Anholt <[email protected]>
* mesa: Fix some signed-unsigned comparison warningsJan Vesely2015-01-211-1/+1
| | | | | | | | v2: s/unsigned int/unsigned/ in prog_optimize.c Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: remove unused ctx parameter for _mesa_select_tex_image()Brian Paul2015-01-051-3/+3
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa/main: Modify generate_mipmap_compressed to cope with float texturesNeil Roberts2014-08-121-5/+8
| | | | | | | | | Once we add BPTC texture support we will need to generate mipmaps for compressed floating point textures too. Most of the code seems to already be there but it just needs a few extra lines to get it to use GL_FLOAT instead of GL_UNSIGNED_BYTE as the type for the temporary buffers. Reviewed-by: Ian Romanick <[email protected]>
* mesa: fix software fallback for generating mipmaps for 3D texturesMarek Olšák2014-03-211-21/+16
| | | | | | | | It didn't use the driver-provided src/dstRowStride at all. This was broken for the cases when stride != width*bpp. Cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* mesa: fix software fallback for generating mipmaps for cube arraysMarek Olšák2014-03-211-2/+5
| | | | | Cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* mesa: change gl_format to mesa_formatMark Mueller2014-01-271-2/+2
| | | | s/\bgl_format\b/mesa_format/g. Use better name for Mesa Formats enum
* mesa: consolidate multiple next_mipmap_level_sizeCourtney Goeltzenleuchter2013-12-131-4/+4
| | | | | | | | | Refactor to make next_mipmap_level_size defined in mipmap.c a _mesa_ helper function that can then be used by texture_view Signed-off-by: Courtney Goeltzenleuchter <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: improve free() cleanup in generate_mipmap_compressed()Brian Paul2013-07-311-10/+7
| | | | | | | | | | Free all our temporary buffers in one place at the end of the function. Fixes memory leak detected by Coverity. Note: This is a candidate for the 9.x branches Cc: [email protected] Reviewed-by: José Fonseca <[email protected]>
* mesa: implement mipmap generation for compressed 2D array texturesBrian Paul2013-07-241-16/+43
| | | | | | | | | | | | We weren't looping over all the slices in the array. The updated code should also correctly handle 3D compressed textures too, whenever we have that feature. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66850 NOTE: This is a candidate for the 9.x branches Cc: [email protected] Reviewed-by: José Fonseca <[email protected]>
* mesa: s/GLint/GLuint/ to fix MSVC warnings in mipmap.cBrian Paul2013-07-121-2/+2
|
* 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]>
* Don't cast the return value of malloc/reallocMatt Turner2012-09-051-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+2
| | | | | 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-2/+1
| | | | | | | | | | 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]>
* mesa: move more format helper functions to glformats.cBrian Paul2012-07-241-0/+1
|
* mesa: consolidate internal glTexSubImage1/2/3D codeBrian Paul2012-06-061-4/+4
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Fix memory leak in generate_mipmap_compressed.Vinson Lee2012-03-261-0/+1
| | | | | | | | | | Fixes Coverity resource leak defect. NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Fix copy-and-paste bug in do_row_3DIan Romanick2012-02-021-3/+3
| | | | | | | | | | | | | Several of the half-float cases used 4 as the texel size when it should have been some smaller value. NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43324 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43325
* mesa: remove incorrect (float) cast in mipmap do_row()Brian Paul2012-01-121-1/+1
| | | | | | | | | | | The array holds GLuint values so remove the float cast. Note, however, that to compute the average of four GLuints we really want to do (a+b+c+d)/4 but that could overflow. This change doesn't address that for now. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: José Fonseca <[email protected]>
* mesa: remove unused _mesa_init_teximage_fields() target parameterBrian Paul2012-01-041-1/+1
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Yuanhan Liu <[email protected]>
* mesa: simplify Driver.TexSubImage() parametersBrian Paul2011-12-301-3/+2
| | | | | | | | There's no need to pass the target, level and texObj parameters since they can be easily obtained from the texImage pointer. Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: new _mesa_prepare_mipmap_level() function for mipmap generationBrian Paul2011-12-161-33/+95
| | | | | | | | | | | | | | | | This helper function is used during mipmap generation to prepare space for the destination mipmap levels. This improves/fixes two things: 1. If the texture object was created with glTexStorage2D, calling _mesa_TexImage2D() to allocate the new image would generate INVALID_OPERATION since the texture is marked as immutable. 2. _mesa_TexImage2D() always frees any existing texture image memory before allocating new memory. That's inefficient if the existing image is the right size already. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: fix potential mem leak in generate_mipmap_compressed()Brian Paul2011-12-021-0/+1
| | | | | | Fixes a coverity warning. Reviewed-by: Vinson Lee <[email protected]>
* mesa: handle MapTextureImage() failures in mipmap generation codeBrian Paul2011-11-281-24/+57
| | | | | | And handle potential malloc failures too. Reviewed-by: Eric Anholt <[email protected]>
* mesa: add support for GL_OES_EGL_image_externalChia-I Wu2011-11-031-0/+1
| | | | | | | | | This is an OpenGL ES specific extension. External textures are textures that may be sampled from, but not be updated (no glTexSubImage* and etc.). The image data are taken from an EGLImage. Reviewed-by: Brian Paul <[email protected]> Acked-by: Jakob Bornecrantz <[email protected]>
* mesa: fix software mipmap generation code for packed Z/stencil formatsBrian Paul2011-10-071-1/+37
| | | | | | Fixes https://bugs.freedesktop.org/show_bug.cgi?id=32458 Reviewed-by: Chad Versace <[email protected]>
* mesa: remove unused _mesa_rescale_teximage2d() functionBrian Paul2011-10-051-75/+0
| | | | It was only used by the old tdfx driver, IIRC.
* mesa: remove unused gl_texture_image::DriverData fieldBrian Paul2011-10-051-1/+0
| | | | Was only used by some older/removed DRI drivers.
* mesa: Reuse existing make_2d_mipmap for 2D array generation.Eric Anholt2011-10-031-99/+5
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: Make the uncompressed sw mipmap gen path do a Map per 1D array slice.Eric Anholt2011-10-031-44/+17
| | | | | | This also fixes what was probably a bug in 1D arrays with border. Reviewed-by: Brian Paul <[email protected]>
* mesa: Convert _mesa_generate_mipmap to MapTexImage()-based access.Brian Paul2011-10-031-122/+148
| | | | | | | | | | | Now that we can zero-copy generate the mipmaps into brand new glTexImage()-generated storage using MapTextureImage(), we no longer need to allocate image->Data in mipmap generate. This requires deleting the drivers' old overrides of the miptree tracking after calling _mesa_generate_mipmap at the same time, or the drivers promptly lose our newly-generated data. Reviewed-by: Eric Anholt <[email protected]>
* mesa: simplify parameters to GetTexImage() driver hookBrian Paul2011-09-301-2/+3
| | | | | | | The target, level and texObj can be obtained through the texImage parameter. We could make similar changes for the TexImage() hooks too. Reviewed-by: Eric Anholt <[email protected]>
* mesa: fix indentation in mipmap.c (3 spaces)Brian Paul2011-09-261-2/+2
|
* mesa: move _mesa_upscale_teximage2d() to texcompress_fxt1.cBrian Paul2011-09-201-34/+0
| | | | Was used by no other code.
* mesa: s/GLchan/GLubyte/ in mipmap generation codeBrian Paul2011-09-201-3/+3
|
* mesa: use ctx->Driver.AllocTextureImageBuffer() to alloc texture memoryBrian Paul2011-09-171-9/+7
|
* mesa: move _mesa_update_fetch_functions() calls into swrastBrian Paul2011-09-171-4/+0
| | | | | | Do it during swrast state validation since the FetchTexel() functions are only called from swrast now and not core Mesa. Remove assertions in mipmap.c since they're no longer appropriate.
* mesa: use ctx->Driver.GetTexImage() to decompress base texture imageBrian Paul2011-09-081-42/+43
| | | | | This is a simple way to do the job and it removes one more use of the soon-to-be-removed gl_texture_image::FetchTexelc() function.