mesa: move setting USAGE_PIXEL_PACK_BUFFER out of BindBuffer to reduce overhead

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13513>
This commit is contained in:
Marek Olšák 2021-10-19 23:48:51 -04:00 committed by Marge Bot
parent d3a134bbd7
commit 2f059b861e
5 changed files with 21 additions and 4 deletions

View file

@ -1127,10 +1127,6 @@ bind_buffer_object(struct gl_context *ctx,
if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
&newBufObj, "glBindBuffer"))
return;
/* record usage history */
if (bindTarget == &ctx->Pack.BufferObj)
newBufObj->UsageHistory |= USAGE_PIXEL_PACK_BUFFER;
}
/* bind new buffer */

View file

@ -343,6 +343,9 @@ _mesa_GetnPixelMapfvARB( GLenum map, GLsizei bufSize, GLfloat *values )
return;
}
if (ctx->Pack.BufferObj)
ctx->Pack.BufferObj->UsageHistory |= USAGE_PIXEL_PACK_BUFFER;
values = (GLfloat *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values);
if (!values) {
if (ctx->Pack.BufferObj) {
@ -392,6 +395,9 @@ _mesa_GetnPixelMapuivARB( GLenum map, GLsizei bufSize, GLuint *values )
return;
}
if (ctx->Pack.BufferObj)
ctx->Pack.BufferObj->UsageHistory |= USAGE_PIXEL_PACK_BUFFER;
values = (GLuint *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values);
if (!values) {
if (ctx->Pack.BufferObj) {
@ -441,6 +447,9 @@ _mesa_GetnPixelMapusvARB( GLenum map, GLsizei bufSize, GLushort *values )
return;
}
if (ctx->Pack.BufferObj)
ctx->Pack.BufferObj->UsageHistory |= USAGE_PIXEL_PACK_BUFFER;
values = (GLushort *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values);
if (!values) {
if (ctx->Pack.BufferObj) {

View file

@ -294,6 +294,9 @@ _mesa_GetnPolygonStippleARB( GLsizei bufSize, GLubyte *dest )
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glGetPolygonStipple\n");
if (ctx->Pack.BufferObj)
ctx->Pack.BufferObj->UsageHistory |= USAGE_PIXEL_PACK_BUFFER;
dest = _mesa_map_validate_pbo_dest(ctx, 2,
&ctx->Pack, 32, 32, 1,
GL_COLOR_INDEX, GL_BITMAP,

View file

@ -1170,6 +1170,9 @@ read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
}
}
if (ctx->Pack.BufferObj)
ctx->Pack.BufferObj->UsageHistory |= USAGE_PIXEL_PACK_BUFFER;
ctx->Driver.ReadPixels(ctx, x, y, width, height,
format, type, &clippedPacking, pixels);
}

View file

@ -1428,6 +1428,9 @@ get_texture_image(struct gl_context *ctx,
numFaces = 1;
}
if (ctx->Pack.BufferObj)
ctx->Pack.BufferObj->UsageHistory |= USAGE_PIXEL_PACK_BUFFER;
_mesa_lock_texture(ctx, texObj);
for (i = 0; i < numFaces; i++) {
@ -1804,6 +1807,9 @@ get_compressed_texture_image(struct gl_context *ctx,
numFaces = 1;
}
if (ctx->Pack.BufferObj)
ctx->Pack.BufferObj->UsageHistory |= USAGE_PIXEL_PACK_BUFFER;
_mesa_lock_texture(ctx, texObj);
for (i = 0; i < numFaces; i++) {