summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_accum.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-04-27 02:50:31 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-04-27 02:50:31 +0000
commitc4fe46f0b8b45407ea40500b869ae1beca71063c (patch)
tree49278ff60f8e6af5f127cff10c266565245f2f4c /src/mesa/swrast/s_accum.c
parent444cd293fd69d1848b2c55f75674d563e0582fba (diff)
fixes for CHAN_BITS!=8
Diffstat (limited to 'src/mesa/swrast/s_accum.c')
-rw-r--r--src/mesa/swrast/s_accum.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c
index cf6dab912b..a159e80497 100644
--- a/src/mesa/swrast/s_accum.c
+++ b/src/mesa/swrast/s_accum.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -35,6 +35,9 @@
#include "s_span.h"
+/* XXX this would have to change for accum buffers with more or less
+ * than 16 bits per color channel.
+ */
#define ACCUM_SCALE16 32767.0
@@ -419,9 +422,6 @@ accum_load(GLcontext *ctx, GLfloat value,
}
}
}
- else {
- /* other types someday */
- }
}
@@ -462,7 +462,8 @@ accum_return(GLcontext *ctx, GLfloat value,
if (accumRb->DataType == GL_SHORT ||
accumRb->DataType == GL_UNSIGNED_SHORT) {
const GLfloat scale = value * CHAN_MAXF / ACCUM_SCALE16;
- GLuint buffer, i;
+ GLuint buffer;
+ GLint i;
/* XXX maybe transpose the 'i' and 'buffer' loops??? */
for (i = 0; i < height; i++) {
@@ -496,10 +497,17 @@ accum_return(GLcontext *ctx, GLfloat value,
/* scaled integer (or float) accum buffer */
GLint j;
for (j = 0; j < width; j++) {
+#if CHAN_BITS==32
+ GLchan r = acc[j * 4 + 0] * scale;
+ GLchan g = acc[j * 4 + 1] * scale;
+ GLchan b = acc[j * 4 + 2] * scale;
+ GLchan a = acc[j * 4 + 3] * scale;
+#else
GLint r = IROUND( (GLfloat) (acc[j * 4 + 0]) * scale );
GLint g = IROUND( (GLfloat) (acc[j * 4 + 1]) * scale );
GLint b = IROUND( (GLfloat) (acc[j * 4 + 2]) * scale );
GLint a = IROUND( (GLfloat) (acc[j * 4 + 3]) * scale );
+#endif
rgba[j][RCOMP] = CLAMP( r, 0, CHAN_MAX );
rgba[j][GCOMP] = CLAMP( g, 0, CHAN_MAX );
rgba[j][BCOMP] = CLAMP( b, 0, CHAN_MAX );