aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_cb_blit.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-08-05 08:17:38 +0200
committermarha <marha@users.sourceforge.net>2011-08-05 08:17:38 +0200
commit67e52c577364b17e7339b04faf17c77cd3ad9b59 (patch)
tree0bc2b0c652907d4c9e4ba2f486754a23ca91147b /mesalib/src/mesa/state_tracker/st_cb_blit.c
parent23cc74efd16feb2676978b9919a8510ed7804ed9 (diff)
parentd105412503ea250e07d3cb008f10f60e6e48bf8a (diff)
downloadvcxsrv-67e52c577364b17e7339b04faf17c77cd3ad9b59.tar.gz
vcxsrv-67e52c577364b17e7339b04faf17c77cd3ad9b59.tar.bz2
vcxsrv-67e52c577364b17e7339b04faf17c77cd3ad9b59.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/glsl/ast_to_hir.cpp mesalib/src/mesa/SConscript mesalib/src/mesa/main/compiler.h mesalib/src/mesa/main/enable.c mesalib/src/mesa/main/ff_fragment_shader.cpp mesalib/src/mesa/main/texcompress_rgtc_tmp.h mesalib/src/mesa/main/texobj.c mesalib/src/mesa/main/texparam.c mesalib/src/mesa/main/uniforms.c mesalib/src/mesa/program/ir_to_mesa.cpp mesalib/src/mesa/program/prog_print.c mesalib/src/mesa/program/prog_statevars.c mesalib/src/mesa/program/program.c mesalib/src/mesa/program/program_parse.y mesalib/src/mesa/program/program_parser.h mesalib/src/mesa/program/sampler.cpp mesalib/src/mesa/sources.mak mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c mesalib/src/mesa/state_tracker/st_cb_blit.c mesalib/src/mesa/state_tracker/st_cb_drawpixels.c mesalib/src/mesa/state_tracker/st_extensions.c mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c mesalib/src/mesa/state_tracker/st_program.c mesalib/src/mesa/state_tracker/st_texture.h mesalib/src/mesa/vbo/vbo_exec_array.c pixman/pixman/pixman-arm-neon-asm.S pixman/pixman/pixman-arm-neon.c
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_cb_blit.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_blit.c117
1 files changed, 112 insertions, 5 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c
index 282f84ec7..63afc1c24 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_blit.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_blit.c
@@ -62,6 +62,82 @@ st_destroy_blit(struct st_context *st)
#if FEATURE_EXT_framebuffer_blit
static void
+st_BlitFramebuffer_resolve(struct gl_context *ctx,
+ GLbitfield mask,
+ struct pipe_resolve_info *info)
+{
+ const GLbitfield depthStencil = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
+
+ struct st_context *st = st_context(ctx);
+
+ struct st_renderbuffer *srcRb, *dstRb;
+
+ if (mask & GL_COLOR_BUFFER_BIT) {
+ srcRb = st_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
+ dstRb = st_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]);
+
+ info->mask = PIPE_MASK_RGBA;
+
+ info->src.res = srcRb->texture;
+ info->src.layer = srcRb->surface->u.tex.first_layer;
+ info->dst.res = dstRb->texture;
+ info->dst.level = dstRb->surface->u.tex.level;
+ info->dst.layer = dstRb->surface->u.tex.first_layer;
+
+ st->pipe->resource_resolve(st->pipe, info);
+ }
+
+ if (mask & depthStencil) {
+ struct gl_renderbuffer_attachment *srcDepth, *srcStencil;
+ struct gl_renderbuffer_attachment *dstDepth, *dstStencil;
+ boolean combined;
+
+ srcDepth = &ctx->ReadBuffer->Attachment[BUFFER_DEPTH];
+ dstDepth = &ctx->DrawBuffer->Attachment[BUFFER_DEPTH];
+ srcStencil = &ctx->ReadBuffer->Attachment[BUFFER_STENCIL];
+ dstStencil = &ctx->DrawBuffer->Attachment[BUFFER_STENCIL];
+
+ combined =
+ st_is_depth_stencil_combined(srcDepth, srcStencil) &&
+ st_is_depth_stencil_combined(dstDepth, dstStencil);
+
+ if ((mask & GL_DEPTH_BUFFER_BIT) || combined) {
+ /* resolve depth and, if combined and requested, stencil as well */
+ srcRb = st_renderbuffer(srcDepth->Renderbuffer);
+ dstRb = st_renderbuffer(dstDepth->Renderbuffer);
+
+ info->mask = (mask & GL_DEPTH_BUFFER_BIT) ? PIPE_MASK_Z : 0;
+ if (combined && (mask & GL_STENCIL_BUFFER_BIT))
+ info->mask |= PIPE_MASK_S;
+
+ info->src.res = srcRb->texture;
+ info->src.layer = srcRb->surface->u.tex.first_layer;
+ info->dst.res = dstRb->texture;
+ info->dst.level = dstRb->surface->u.tex.level;
+ info->dst.layer = dstRb->surface->u.tex.first_layer;
+
+ st->pipe->resource_resolve(st->pipe, info);
+ }
+
+ if (mask & GL_STENCIL_BUFFER_BIT) {
+ /* resolve separate stencil buffer */
+ srcRb = st_renderbuffer(srcStencil->Renderbuffer);
+ dstRb = st_renderbuffer(dstStencil->Renderbuffer);
+
+ info->mask = PIPE_MASK_S;
+
+ info->src.res = srcRb->texture;
+ info->src.layer = srcRb->surface->u.tex.first_layer;
+ info->dst.res = dstRb->texture;
+ info->dst.level = dstRb->surface->u.tex.level;
+ info->dst.layer = dstRb->surface->u.tex.first_layer;
+
+ st->pipe->resource_resolve(st->pipe, info);
+ }
+ }
+}
+
+static void
st_BlitFramebuffer(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
@@ -95,6 +171,42 @@ st_BlitFramebuffer(struct gl_context *ctx,
srcY1 = readFB->Height - srcY1;
}
+ /* Disable conditional rendering. */
+ if (st->render_condition) {
+ st->pipe->render_condition(st->pipe, NULL, 0);
+ }
+
+ if (readFB->Visual.sampleBuffers > drawFB->Visual.sampleBuffers) {
+ struct pipe_resolve_info info;
+
+ if (dstX0 < dstX1) {
+ info.dst.x0 = dstX0;
+ info.dst.x1 = dstX1;
+ info.src.x0 = srcX0;
+ info.src.x1 = srcX1;
+ } else {
+ info.dst.x0 = dstX1;
+ info.dst.x1 = dstX0;
+ info.src.x0 = srcX1;
+ info.src.x1 = srcX0;
+ }
+ if (dstY0 < dstY1) {
+ info.dst.y0 = dstY0;
+ info.dst.y1 = dstY1;
+ info.src.y0 = srcY0;
+ info.src.y1 = srcY1;
+ } else {
+ info.dst.y0 = dstY1;
+ info.dst.y1 = dstY0;
+ info.src.y0 = srcY1;
+ info.src.y1 = srcY0;
+ }
+
+ st_BlitFramebuffer_resolve(ctx, mask, &info); /* filter doesn't apply */
+
+ goto done;
+ }
+
if (srcY0 > srcY1 && dstY0 > dstY1) {
/* Both src and dst are upside down. Swap Y to make it
* right-side up to increase odds of using a fast path.
@@ -109,11 +221,6 @@ st_BlitFramebuffer(struct gl_context *ctx,
dstY1 = tmp;
}
- /* Disable conditional rendering. */
- if (st->render_condition) {
- st->pipe->render_condition(st->pipe, NULL, 0);
- }
-
if (mask & GL_COLOR_BUFFER_BIT) {
struct gl_renderbuffer_attachment *srcAtt =
&readFB->Attachment[readFB->_ColorReadBufferIndex];