summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2013-02-05 12:20:39 -0700
committerAndreas Boll <andreas.boll.dev@gmail.com>2013-02-13 21:48:37 +0100
commit2389fcc8025458e4872b83feb72727ab38f07f33 (patch)
treed8e6f34e0e03bed0dd08e0ac76b3e78cfade3705
parentcef854dba71dc1af27b0e32cc026e9a54bc45473 (diff)
svga: fix sRGB rendering
We weren't emitting the SVGA_RS_OUTPUTGAMMA state so sRGB rendering didn't work properly. Fixes piglit's framebuffer-srgb test. Note: This is a candidate for the stable branches. Reviewed-by: Jose Fonseca <jfonseca@vmware.com> (cherry picked from commit ff605091579a0dfbb6a6b3ea0e46d6fed28a278b)
-rw-r--r--src/gallium/drivers/svga/svga_state_rss.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_state_rss.c b/src/gallium/drivers/svga/svga_state_rss.c
index 6a739241af..51d36b751b 100644
--- a/src/gallium/drivers/svga/svga_state_rss.c
+++ b/src/gallium/drivers/svga/svga_state_rss.c
@@ -23,6 +23,7 @@
*
**********************************************************/
+#include "util/u_format.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "pipe/p_defines.h"
@@ -248,6 +249,16 @@ emit_rss(struct svga_context *svga, unsigned dirty)
EMIT_RS_FLOAT( svga, bias, DEPTHBIAS, fail );
}
+ if (dirty & SVGA_NEW_FRAME_BUFFER) {
+ /* XXX: we only look at the first color buffer's sRGB state */
+ float gamma = 1.0f;
+ if (svga->curr.framebuffer.cbufs[0] &&
+ util_format_is_srgb(svga->curr.framebuffer.cbufs[0]->format)) {
+ gamma = 2.2f;
+ }
+ EMIT_RS_FLOAT(svga, gamma, OUTPUTGAMMA, fail);
+ }
+
if (dirty & SVGA_NEW_RAST) {
/* bitmask of the enabled clip planes */
unsigned enabled = svga->curr.rast->templ.clip_plane_enable;