summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_accum.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2011-01-22 18:28:20 -0700
committerBrian Paul <brianp@vmware.com>2011-01-22 18:33:35 -0700
commit9d380f487a4f2628594821a4fed5fe587ce52031 (patch)
tree6128e468224eac1a19b2efec191332303b58261a /src/mesa/state_tracker/st_cb_accum.c
parent4c9ad084c1f54d83b4f27ce2b4cec23b6c7371c8 (diff)
st/mesa: ensure that all pixel paths operation on linear RGB data, not sRGB
Before, we were converting between linear/sRGB in glReadPixels, glDrawPixels, glAccum, etc if the renderbuffer was an sRGB texture. Those all need to operate on pixel values as-is without conversion. Also, when setting up render-to-texture, if the texture is sRGB the pipe_surface view must be linear RGB. This will change when we support GL_ARB_framebuffer_sRGB. This fixes http://bugs.freedesktop.org/show_bug.cgi?id=33353
Diffstat (limited to 'src/mesa/state_tracker/st_cb_accum.c')
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index 35921f4f61..3e01c440bd 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -42,6 +42,7 @@
#include "st_texture.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
+#include "util/u_format.h"
#include "util/u_inlines.h"
#include "util/u_tile.h"
@@ -146,7 +147,9 @@ accum_accum(struct st_context *st, GLfloat value,
buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
+ pipe_get_tile_rgba_format(pipe, color_trans, 0, 0, width, height,
+ util_format_linear(color_strb->texture->format),
+ buf);
switch (acc_strb->format) {
case PIPE_FORMAT_R16G16B16A16_SNORM:
@@ -183,7 +186,6 @@ accum_load(struct st_context *st, GLfloat value,
GLubyte *data = acc_strb->data;
GLfloat *buf;
-
if (ST_DEBUG & DEBUG_FALLBACK)
debug_printf("%s: fallback processing\n", __FUNCTION__);
@@ -194,7 +196,9 @@ accum_load(struct st_context *st, GLfloat value,
buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
+ pipe_get_tile_rgba_format(pipe, color_trans, 0, 0, width, height,
+ util_format_linear(color_strb->texture->format),
+ buf);
switch (acc_strb->format) {
case PIPE_FORMAT_R16G16B16A16_SNORM:
@@ -232,6 +236,7 @@ accum_return(struct gl_context *ctx, GLfloat value,
size_t stride = acc_strb->stride;
const GLubyte *data = acc_strb->data;
GLfloat *buf;
+ enum pipe_format format = util_format_linear(color_strb->texture->format);
if (ST_DEBUG & DEBUG_FALLBACK)
debug_printf("%s: fallback processing\n", __FUNCTION__);
@@ -250,7 +255,8 @@ accum_return(struct gl_context *ctx, GLfloat value,
width, height);
if (usage & PIPE_TRANSFER_READ)
- pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
+ pipe_get_tile_rgba_format(pipe, color_trans, 0, 0, width, height,
+ format, buf);
switch (acc_strb->format) {
case PIPE_FORMAT_R16G16B16A16_SNORM:
@@ -279,7 +285,8 @@ accum_return(struct gl_context *ctx, GLfloat value,
_mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
}
- pipe_put_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
+ pipe_put_tile_rgba_format(pipe, color_trans, 0, 0, width, height,
+ format, buf);
free(buf);
pipe->transfer_destroy(pipe, color_trans);