mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
st/mesa: fix incorrect glCopyPixels between window/FBO
There was a DrawBuffer/ReadBuffer typo and we were neglecting to invert the texture coords when copying from a window to an FBO. Plus, add some surface dump/debug code (disabled).
This commit is contained in:
parent
8d3f629a13
commit
34f0207161
1 changed files with 16 additions and 4 deletions
|
|
@ -968,6 +968,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
GLfloat *color;
|
||||
enum pipe_format srcFormat, texFormat;
|
||||
int ptw, pth;
|
||||
GLboolean invertTex = GL_FALSE;
|
||||
|
||||
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
|
||||
|
||||
|
|
@ -1043,8 +1044,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
}
|
||||
}
|
||||
|
||||
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
|
||||
srcy = ctx->DrawBuffer->Height - srcy - height;
|
||||
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
|
||||
srcy = ctx->ReadBuffer->Height - srcy - height;
|
||||
|
||||
if (srcy < 0) {
|
||||
height -= -srcy;
|
||||
|
|
@ -1053,6 +1054,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
|
||||
if (height < 0)
|
||||
return;
|
||||
|
||||
invertTex = !invertTex;
|
||||
}
|
||||
|
||||
/* Need to use POT texture? */
|
||||
|
|
@ -1082,7 +1085,9 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
if (!pt)
|
||||
return;
|
||||
|
||||
|
||||
/* Make temporary texture which is a copy of the src region.
|
||||
* We'll draw a quad with this texture to draw the dest image.
|
||||
*/
|
||||
if (srcFormat == texFormat) {
|
||||
/* copy source framebuffer surface into mipmap/texture */
|
||||
struct pipe_surface *psRead = screen->get_tex_surface(screen,
|
||||
|
|
@ -1103,6 +1108,13 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
psRead,
|
||||
srcx, srcy, width, height);
|
||||
}
|
||||
|
||||
if (0) {
|
||||
/* debug */
|
||||
debug_dump_surface("copypixsrcsurf", psRead);
|
||||
debug_dump_surface("copypixtemptex", psTex);
|
||||
}
|
||||
|
||||
pipe_surface_reference(&psRead, NULL);
|
||||
pipe_surface_reference(&psTex, NULL);
|
||||
}
|
||||
|
|
@ -1150,7 +1162,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
/* draw textured quad */
|
||||
draw_textured_quad(ctx, dstx, dsty, ctx->Current.RasterPos[2],
|
||||
width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY,
|
||||
pt, stvp, stfp, color, GL_TRUE);
|
||||
pt, stvp, stfp, color, invertTex);
|
||||
|
||||
pipe_texture_reference(&pt, NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue