mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 07:38:10 +02:00
st/mesa: always use PIPE_USAGE_STAGING for GL_MAP_READ_BIT usage
This fixes CPU read performance.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5091
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11974>
(cherry picked from commit 54e1ec017d)
This commit is contained in:
parent
3b1f5b2d5a
commit
cea26a9813
2 changed files with 12 additions and 8 deletions
|
|
@ -427,7 +427,7 @@
|
|||
"description": "st/mesa: always use PIPE_USAGE_STAGING for GL_MAP_READ_BIT usage",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -250,16 +250,20 @@ static enum pipe_resource_usage
|
|||
buffer_usage(GLenum target, GLboolean immutable,
|
||||
GLbitfield storageFlags, GLenum usage)
|
||||
{
|
||||
/* "immutable" means that "storageFlags" was set by the user and "usage"
|
||||
* was guessed by Mesa. Otherwise, "usage" was set by the user and
|
||||
* storageFlags was guessed by Mesa.
|
||||
*
|
||||
* Therefore, use storageFlags with immutable, else use "usage".
|
||||
*/
|
||||
if (immutable) {
|
||||
/* BufferStorage */
|
||||
if (storageFlags & GL_CLIENT_STORAGE_BIT) {
|
||||
if (storageFlags & GL_MAP_READ_BIT)
|
||||
return PIPE_USAGE_STAGING;
|
||||
else
|
||||
return PIPE_USAGE_STREAM;
|
||||
} else {
|
||||
if (storageFlags & GL_MAP_READ_BIT)
|
||||
return PIPE_USAGE_STAGING;
|
||||
else if (storageFlags & GL_CLIENT_STORAGE_BIT)
|
||||
return PIPE_USAGE_STREAM;
|
||||
else
|
||||
return PIPE_USAGE_DEFAULT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* These are often read by the CPU, so enable CPU caches. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue