Bug 103672 - _mesa_meta_GenerateMipmap sub-optimal code and possible bug
Summary: _mesa_meta_GenerateMipmap sub-optimal code and possible bug
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: unspecified
Hardware: All All
: medium normal
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-10 17:45 UTC by Dale Weiler
Modified: 2019-09-25 19:05 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Dale Weiler 2017-11-10 17:45:18 UTC
Was just reviewing this code since I hit a pathological edge case where it was severly impacting the performance of generating mip levels and was surprised to see the approach taken.

Couple of alarming issues:

1. It uploads vertex data for every mip level to draw a quad, when this data only needs to be uploaded once, lifting that out of the for loop is a trivial one line change but will need further changes because of the _mesa_meta_setup_texture_coords stuff, probably best to create one large vertex buffer for all of this upfront instead.

2. It allocates storage for every mip level one iteration at a time when it couple upfront allocate all the storage needed to represent all mip levels in one shot.

3. When setting minification to the source level, I'm sure this is a copy-paste bug (since it's called above to set max level but then called again), but appears to use GL_TEXTURE_MAX_LEVEL instead of GL_TEXTURE_MIN_LEVEL.

4. The comment says it does not support 3D textures yet but it appears the code does handle 3D textures.

5. The approach itself seems like it could better be done via glCopyTexImage* family of functions which already take from the read buffer, thus avoiding ugly vbo/vao state changes (as well as viewport changes) and issuing a draw call for each mip level.
Comment 1 Timothy Arceri 2018-04-10 05:37:04 UTC
Moving to i965 as it is the only driver to use this.
Comment 2 GitLab Migration User 2019-09-25 19:05:32 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1649.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.