summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_accum.c
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-06-27 19:37:56 +0900
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-06-27 19:37:56 +0900
commit4ddd65967915ca4846f2831bc676c878a29dae4a (patch)
treef2c66e355d5e9ea6f80531f995ccc25166d06fc3 /src/mesa/state_tracker/st_cb_accum.c
parent05cfb4c4b84b4e3119112c381ceffc583a4ef5fe (diff)
gallium: Drop pipe_texture->cpp and pipe_surface->cpp.
The chars-per-pixel concept falls apart with compressed and yuv images, where more than one pixel are coded in a single data block.
Diffstat (limited to 'src/mesa/state_tracker/st_cb_accum.c')
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index 8098d75e18..809a906ba3 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -66,15 +66,17 @@ acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps,
uint x, uint y, uint w, uint h, float *p)
{
const enum pipe_format f = acc_ps->format;
- const int cpp = acc_ps->cpp;
+ const struct pipe_format_block b = acc_ps->block;
acc_ps->format = DEFAULT_ACCUM_PIPE_FORMAT;
- acc_ps->cpp = 8;
+ acc_ps->block.size = 8;
+ acc_ps->block.width = 1;
+ acc_ps->block.height = 1;
pipe_get_tile_rgba(pipe, acc_ps, x, y, w, h, p);
acc_ps->format = f;
- acc_ps->cpp = cpp;
+ acc_ps->block = b;
}
@@ -88,15 +90,17 @@ acc_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps,
uint x, uint y, uint w, uint h, const float *p)
{
enum pipe_format f = acc_ps->format;
- const int cpp = acc_ps->cpp;
+ const struct pipe_format_block b = acc_ps->block;
acc_ps->format = DEFAULT_ACCUM_PIPE_FORMAT;
- acc_ps->cpp = 8;
+ acc_ps->block.size = 8;
+ acc_ps->block.width = 1;
+ acc_ps->block.height = 1;
pipe_put_tile_rgba(pipe, acc_ps, x, y, w, h, p);
acc_ps->format = f;
- acc_ps->cpp = cpp;
+ acc_ps->block = b;
}
@@ -111,7 +115,7 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
const GLint ypos = ctx->DrawBuffer->_Ymin;
const GLint width = ctx->DrawBuffer->_Xmax - xpos;
const GLint height = ctx->DrawBuffer->_Ymax - ypos;
- GLvoid *map;
+ GLubyte *map;
acc_ps = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0,
PIPE_BUFFER_USAGE_CPU_WRITE);
@@ -128,8 +132,7 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
GLshort a = FLOAT_TO_SHORT(ctx->Accum.ClearColor[3]);
int i, j;
for (i = 0; i < height; i++) {
- GLshort *dst = ((GLshort *) map
- + ((ypos + i) * acc_ps->pitch + xpos) * 4);
+ GLshort *dst = (GLshort *) (map + (ypos + i) * acc_ps->stride + xpos * 8);
for (j = 0; j < width; j++) {
dst[0] = r;
dst[1] = g;
@@ -168,8 +171,7 @@ accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias,
{
int i, j;
for (i = 0; i < height; i++) {
- GLshort *acc = ((GLshort *) map
- + ((ypos + i) * acc_ps->pitch + xpos) * 4);
+ GLshort *acc = (GLshort *) (map + (ypos + i) * acc_ps->stride + xpos * 8);
for (j = 0; j < width * 4; j++) {
float val = SHORT_TO_FLOAT(acc[j]) * scale + bias;
acc[j] = FLOAT_TO_SHORT(val);