summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_atom_framebuffer.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-02-06 19:01:58 +1000
committerDave Airlie <airlied@redhat.com>2011-02-10 10:14:27 +1000
commit21b0996dfcbe62c55dd31cc316cd47f2b8531d2e (patch)
tree9cb804ac4f5dfed19ff947dfaf89a94b162b3968 /src/mesa/state_tracker/st_atom_framebuffer.c
parent3b8bb7b449dae6c16df0fa45e6567ec3d6b05dcc (diff)
mesa/st: enable GL_EXT_framebuffer_sRGB
If the formats don't match we need to update the surface with the new format. if we can render to SRGB formats, enable the extension Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/mesa/state_tracker/st_atom_framebuffer.c')
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index 2843b7b176..76386fe017 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -39,7 +39,7 @@
#include "cso_cache/cso_context.h"
#include "util/u_math.h"
#include "util/u_inlines.h"
-
+#include "util/u_format.h"
/**
@@ -55,8 +55,10 @@ update_renderbuffer_surface(struct st_context *st,
struct pipe_resource *resource = strb->rtt->pt;
int rtt_width = strb->Base.Width;
int rtt_height = strb->Base.Height;
+ enum pipe_format format = st->ctx->Color.sRGBEnabled ? resource->format : util_format_linear(resource->format);
if (!strb->surface ||
+ strb->surface->format != format ||
strb->surface->texture != resource ||
strb->surface->width != rtt_width ||
strb->surface->height != rtt_height) {
@@ -67,7 +69,7 @@ update_renderbuffer_surface(struct st_context *st,
u_minify(resource->height0, level) == rtt_height) {
struct pipe_surface surf_tmpl;
memset(&surf_tmpl, 0, sizeof(surf_tmpl));
- surf_tmpl.format = resource->format;
+ surf_tmpl.format = format;
surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
surf_tmpl.u.tex.level = level;
surf_tmpl.u.tex.first_layer = strb->rtt_face + strb->rtt_slice;