aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_cb_blit.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-01-15 21:23:25 +0100
committermarha <marha@users.sourceforge.net>2014-01-15 21:23:25 +0100
commit1b0fcca503ae9cf2d462b60770f96c794dfbb27a (patch)
treed08c81de02b94da202195d84c99e192bc24ae69e /mesalib/src/mesa/state_tracker/st_cb_blit.c
parentaaeb8bf497c82efabc4f9b27c319042c0e72d816 (diff)
downloadvcxsrv-1b0fcca503ae9cf2d462b60770f96c794dfbb27a.tar.gz
vcxsrv-1b0fcca503ae9cf2d462b60770f96c794dfbb27a.tar.bz2
vcxsrv-1b0fcca503ae9cf2d462b60770f96c794dfbb27a.zip
mesa xkeyboard-config xserver git update 15 jan 2014
xserver commit 2d2d49dab5c5718989de97d7227aac793479745e xkeyboard-config commit 78af7aa79c6552924295644b911e45d07a0fcdad mesa commit a05c596a00916ce6a9c9d35ff36cd1e401fddd43
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_cb_blit.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_blit.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c
index a236a08e9..82c2e38e5 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_blit.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_blit.c
@@ -44,6 +44,34 @@
static void
+st_adjust_blit_for_msaa_resolve(struct pipe_blit_info *blit)
+{
+ /* Even though we do multisample resolves at the time of the blit, OpenGL
+ * specification defines them as if they happen at the time of rendering,
+ * which means that the type of averaging we do during the resolve should
+ * only depend on the source format; the destination format should be
+ * ignored. But, specification doesn't seem to be strict about it.
+ *
+ * It has been observed that mulitisample resolves produce slightly better
+ * looking images when averaging is done using destination format. NVIDIA's
+ * proprietary OpenGL driver also follows this approach.
+ *
+ * When multisampling, if the source and destination formats are equal
+ * (aside from the color space), we choose to blit in sRGB space to get
+ * this higher quality image.
+ */
+ if (blit->src.resource->nr_samples > 1 &&
+ blit->dst.resource->nr_samples <= 1) {
+ blit->dst.format = blit->dst.resource->format;
+
+ if (util_format_is_srgb(blit->dst.resource->format))
+ blit->src.format = util_format_srgb(blit->src.resource->format);
+ else
+ blit->src.format = util_format_linear(blit->src.resource->format);
+ }
+}
+
+static void
st_BlitFramebuffer(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
@@ -192,6 +220,8 @@ st_BlitFramebuffer(struct gl_context *ctx,
blit.src.box.z = srcAtt->Zoffset + srcAtt->CubeMapFace;
blit.src.format = util_format_linear(srcObj->pt->format);
+ st_adjust_blit_for_msaa_resolve(&blit);
+
st->pipe->blit(st->pipe, &blit);
}
}
@@ -227,6 +257,8 @@ st_BlitFramebuffer(struct gl_context *ctx,
blit.src.box.z = srcSurf->u.tex.first_layer;
blit.src.format = util_format_linear(srcSurf->format);
+ st_adjust_blit_for_msaa_resolve(&blit);
+
st->pipe->blit(st->pipe, &blit);
}
}