mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 17:58:26 +02:00
gallium: fix-up inverted do_copy_texsubimage()
The logic/arithmetic for inverting the src image is a bit simpler now.
This commit is contained in:
parent
f738c3acac
commit
a479bf6235
1 changed files with 30 additions and 21 deletions
|
|
@ -1157,11 +1157,12 @@ do_copy_texsubimage(GLcontext *ctx,
|
||||||
struct pipe_context *pipe = ctx->st->pipe;
|
struct pipe_context *pipe = ctx->st->pipe;
|
||||||
struct pipe_screen *screen = pipe->screen;
|
struct pipe_screen *screen = pipe->screen;
|
||||||
uint dest_format, src_format;
|
uint dest_format, src_format;
|
||||||
uint do_flip = FALSE;
|
|
||||||
GLboolean use_fallback = GL_TRUE;
|
GLboolean use_fallback = GL_TRUE;
|
||||||
|
|
||||||
(void) texImage;
|
(void) texImage;
|
||||||
|
|
||||||
|
/* XX need this? st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);*/
|
||||||
|
|
||||||
/* determine if copying depth or color data */
|
/* determine if copying depth or color data */
|
||||||
if (baseFormat == GL_DEPTH_COMPONENT) {
|
if (baseFormat == GL_DEPTH_COMPONENT) {
|
||||||
strb = st_renderbuffer(fb->_DepthBuffer);
|
strb = st_renderbuffer(fb->_DepthBuffer);
|
||||||
|
|
@ -1178,11 +1179,6 @@ do_copy_texsubimage(GLcontext *ctx,
|
||||||
assert(strb->surface);
|
assert(strb->surface);
|
||||||
assert(stImage->pt);
|
assert(stImage->pt);
|
||||||
|
|
||||||
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
|
|
||||||
srcY = strb->Base.Height - srcY - height;
|
|
||||||
do_flip = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
src_format = strb->surface->format;
|
src_format = strb->surface->format;
|
||||||
dest_format = stImage->pt->format;
|
dest_format = stImage->pt->format;
|
||||||
|
|
||||||
|
|
@ -1190,7 +1186,8 @@ do_copy_texsubimage(GLcontext *ctx,
|
||||||
/* do blit-style copy */
|
/* do blit-style copy */
|
||||||
struct pipe_surface *dest_surface;
|
struct pipe_surface *dest_surface;
|
||||||
|
|
||||||
dest_surface = screen->get_tex_surface(screen, stImage->pt, stImage->face,
|
dest_surface = screen->get_tex_surface(screen, stImage->pt,
|
||||||
|
stImage->face,
|
||||||
stImage->level, destZ,
|
stImage->level, destZ,
|
||||||
PIPE_BUFFER_USAGE_GPU_WRITE);
|
PIPE_BUFFER_USAGE_GPU_WRITE);
|
||||||
|
|
||||||
|
|
@ -1198,6 +1195,7 @@ do_copy_texsubimage(GLcontext *ctx,
|
||||||
assert(dest_surface->buffer);
|
assert(dest_surface->buffer);
|
||||||
|
|
||||||
if (src_format == dest_format) {
|
if (src_format == dest_format) {
|
||||||
|
boolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
|
||||||
pipe->surface_copy(pipe,
|
pipe->surface_copy(pipe,
|
||||||
do_flip,
|
do_flip,
|
||||||
/* dest */
|
/* dest */
|
||||||
|
|
@ -1214,12 +1212,23 @@ do_copy_texsubimage(GLcontext *ctx,
|
||||||
PIPE_TEXTURE) &&
|
PIPE_TEXTURE) &&
|
||||||
screen->is_format_supported(screen, dest_surface->format,
|
screen->is_format_supported(screen, dest_surface->format,
|
||||||
PIPE_SURFACE)) {
|
PIPE_SURFACE)) {
|
||||||
|
boolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
|
||||||
|
int srcY0, srcY1;
|
||||||
|
if (do_flip) {
|
||||||
|
srcY1 = strb->Base.Height - srcY - height;
|
||||||
|
srcY0 = srcY1 + height;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
srcY0 = srcY;
|
||||||
|
srcY1 = srcY0 + height;
|
||||||
|
}
|
||||||
util_blit_pixels(ctx->st->blit,
|
util_blit_pixels(ctx->st->blit,
|
||||||
strb->surface,
|
strb->surface,
|
||||||
srcX, do_flip ? srcY + height : srcY,
|
srcX, srcY0,
|
||||||
srcX + width, do_flip ? srcY : srcY + height,
|
srcX + width, srcY1,
|
||||||
dest_surface,
|
dest_surface,
|
||||||
destX, destY, destX + width, destY + height,
|
destX, destY,
|
||||||
|
destX + width, destY + height,
|
||||||
0.0, PIPE_TEX_MIPFILTER_NEAREST);
|
0.0, PIPE_TEX_MIPFILTER_NEAREST);
|
||||||
use_fallback = GL_FALSE;
|
use_fallback = GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue