mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-09 04:00:12 +01:00
gallium: glCopyTexSubImage improvement.
Only get a texture surface for attempting an accelerated copy, and mark it for GPU use only.
This commit is contained in:
parent
4c6c073f99
commit
650c57f193
1 changed files with 11 additions and 10 deletions
|
|
@ -1127,7 +1127,6 @@ do_copy_texsubimage(GLcontext *ctx,
|
|||
struct st_renderbuffer *strb;
|
||||
struct pipe_context *pipe = ctx->st->pipe;
|
||||
struct pipe_screen *screen = pipe->screen;
|
||||
struct pipe_surface *dest_surface;
|
||||
uint dest_format, src_format;
|
||||
uint do_flip = FALSE;
|
||||
GLboolean use_fallback = GL_TRUE;
|
||||
|
|
@ -1158,13 +1157,7 @@ do_copy_texsubimage(GLcontext *ctx,
|
|||
src_format = strb->surface->format;
|
||||
dest_format = stImage->pt->format;
|
||||
|
||||
dest_surface = screen->get_tex_surface(screen, stImage->pt, stImage->face,
|
||||
stImage->level, destZ,
|
||||
PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||
|
||||
if (ctx->_ImageTransferState == 0x0 &&
|
||||
strb->surface->buffer &&
|
||||
dest_surface->buffer) {
|
||||
if (ctx->_ImageTransferState == 0x0) {
|
||||
/* do blit-style copy */
|
||||
|
||||
/* XXX may need to invert image depending on window
|
||||
|
|
@ -1187,6 +1180,14 @@ do_copy_texsubimage(GLcontext *ctx,
|
|||
x, y + height, dstx, dsty, width, height,
|
||||
GL_COPY); /* ? */
|
||||
#else
|
||||
struct pipe_surface *dest_surface;
|
||||
|
||||
dest_surface = screen->get_tex_surface(screen, stImage->pt, stImage->face,
|
||||
stImage->level, destZ,
|
||||
PIPE_BUFFER_USAGE_GPU_WRITE);
|
||||
|
||||
assert(strb->surface->buffer);
|
||||
assert(dest_surface->buffer);
|
||||
|
||||
if (src_format == dest_format) {
|
||||
pipe->surface_copy(pipe,
|
||||
|
|
@ -1214,6 +1215,8 @@ do_copy_texsubimage(GLcontext *ctx,
|
|||
0.0, PIPE_TEX_MIPFILTER_NEAREST);
|
||||
use_fallback = GL_FALSE;
|
||||
}
|
||||
|
||||
pipe_surface_reference(&dest_surface, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1224,8 +1227,6 @@ do_copy_texsubimage(GLcontext *ctx,
|
|||
srcX, srcY, width, height);
|
||||
}
|
||||
|
||||
pipe_surface_reference(&dest_surface, NULL);
|
||||
|
||||
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
|
||||
ctx->Driver.GenerateMipmap(ctx, target, texObj);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue