rgba[i][RCOMP] = 0;
rgba[i][GCOMP] = 0;
rgba[i][BCOMP] = 0;
+#if CHAN_BITS==32
+ rgba[i][ACOMP] = tableF[i];
+#else
rgba[i][ACOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+#endif
}
}
else {
const GLfloat *tableF = (const GLfloat *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
- rgba[i][GCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+#if CHAN_BITS==32
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] = tableF[i];
+ rgba[i][ACOMP] = CHAN_MAX;
+#else
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
rgba[i][BCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
rgba[i][ACOMP] = CHAN_MAX;
+#endif
}
}
else {
const GLchan *tableUB = (const GLchan *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = tableUB[i];
- rgba[i][GCOMP] = tableUB[i];
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
rgba[i][BCOMP] = tableUB[i];
rgba[i][ACOMP] = CHAN_MAX;
}
const GLfloat *tableF = (const GLfloat *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF);
- rgba[i][GCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF);
+#if CHAN_BITS==32
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] = tableF[i*2+0];
+ rgba[i][ACOMP] = tableF[i*2+1];
+#else
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
rgba[i][BCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF);
rgba[i][ACOMP] = IROUND_POS(tableF[i*2+1] * CHAN_MAXF);
+#endif
}
}
else {
const GLchan *tableUB = (const GLchan *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = tableUB[i*2+0];
- rgba[i][GCOMP] = tableUB[i*2+0];
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
rgba[i][BCOMP] = tableUB[i*2+0];
rgba[i][ACOMP] = tableUB[i*2+1];
}
const GLfloat *tableF = (const GLfloat *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
- rgba[i][GCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
- rgba[i][BCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+#if CHAN_BITS==32
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] =
+ rgba[i][ACOMP] = tableF[i];
+#else
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] =
rgba[i][ACOMP] = IROUND_POS(tableF[i] * CHAN_MAXF);
+#endif
}
}
else {
const GLchan *tableUB = (const GLchan *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = tableUB[i];
- rgba[i][GCOMP] = tableUB[i];
- rgba[i][BCOMP] = tableUB[i];
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] =
rgba[i][ACOMP] = tableUB[i];
}
}
const GLfloat *tableF = (const GLfloat *) table->Table;
GLuint i;
for (i = 0; i < table->Size; i++) {
+#if CHAN_BITS==32
+ rgba[i][RCOMP] = tableF[i*3+0];
+ rgba[i][GCOMP] = tableF[i*3+1];
+ rgba[i][BCOMP] = tableF[i*3+2];
+ rgba[i][ACOMP] = CHAN_MAX;
+#else
rgba[i][RCOMP] = IROUND_POS(tableF[i*3+0] * CHAN_MAXF);
rgba[i][GCOMP] = IROUND_POS(tableF[i*3+1] * CHAN_MAXF);
rgba[i][BCOMP] = IROUND_POS(tableF[i*3+2] * CHAN_MAXF);
rgba[i][ACOMP] = CHAN_MAX;
+#endif
}
}
else {
case GL_RGBA:
if (table->Type == GL_FLOAT) {
const GLfloat *tableF = (const GLfloat *) table->Table;
+#if CHAN_BITS==32
+ _mesa_memcpy(rgba, tableF, 4 * table->Size * sizeof(GLfloat));
+#else
GLuint i;
for (i = 0; i < table->Size; i++) {
rgba[i][RCOMP] = IROUND_POS(tableF[i*4+0] * CHAN_MAXF);
rgba[i][BCOMP] = IROUND_POS(tableF[i*4+2] * CHAN_MAXF);
rgba[i][ACOMP] = IROUND_POS(tableF[i*4+3] * CHAN_MAXF);
}
+#endif
}
else {
const GLchan *tableUB = (const GLchan *) table->Table;
/*
* 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"),
#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
}
}
}
- else {
- /* other types someday */
- }
}
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++) {
/* 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 );
ASSERT(span->end < MAX_WIDTH);
ASSERT(span->arrayMask & SPAN_RGBA);
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
+ ASSERT(rb->DataType == CHAN_TYPE);
if (span->arrayMask & SPAN_XY) {
_swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y,
#define PROD(A,B) ( (GLuint)(A) * ((GLuint)(B)+1) )
#define S_PROD(A,B) ( (GLint)(A) * ((GLint)(B)+1) )
+#if CHAN_BITS == 32
+typedef GLfloat ChanTemp;
+#else
+typedef GLuint ChanTemp;
+#endif
/**
break;
case GL_LUMINANCE:
for (i=0;i<n;i++) {
- GLuint Lt = texel[i][RCOMP];
- GLuint r = rgba[i][RCOMP] + Lt;
- GLuint g = rgba[i][GCOMP] + Lt;
- GLuint b = rgba[i][BCOMP] + Lt;
+ ChanTemp Lt = texel[i][RCOMP];
+ ChanTemp r = rgba[i][RCOMP] + Lt;
+ ChanTemp g = rgba[i][GCOMP] + Lt;
+ ChanTemp b = rgba[i][BCOMP] + Lt;
rgba[i][RCOMP] = MIN2(r, CHAN_MAX);
rgba[i][GCOMP] = MIN2(g, CHAN_MAX);
rgba[i][BCOMP] = MIN2(b, CHAN_MAX);
break;
case GL_LUMINANCE_ALPHA:
for (i=0;i<n;i++) {
- GLuint Lt = texel[i][RCOMP];
- GLuint r = rgba[i][RCOMP] + Lt;
- GLuint g = rgba[i][GCOMP] + Lt;
- GLuint b = rgba[i][BCOMP] + Lt;
+ ChanTemp Lt = texel[i][RCOMP];
+ ChanTemp r = rgba[i][RCOMP] + Lt;
+ ChanTemp g = rgba[i][GCOMP] + Lt;
+ ChanTemp b = rgba[i][BCOMP] + Lt;
rgba[i][RCOMP] = MIN2(r, CHAN_MAX);
rgba[i][GCOMP] = MIN2(g, CHAN_MAX);
rgba[i][BCOMP] = MIN2(b, CHAN_MAX);
case GL_INTENSITY:
for (i=0;i<n;i++) {
GLchan It = texel[i][RCOMP];
- GLuint r = rgba[i][RCOMP] + It;
- GLuint g = rgba[i][GCOMP] + It;
- GLuint b = rgba[i][BCOMP] + It;
- GLuint a = rgba[i][ACOMP] + It;
+ ChanTemp r = rgba[i][RCOMP] + It;
+ ChanTemp g = rgba[i][GCOMP] + It;
+ ChanTemp b = rgba[i][BCOMP] + It;
+ ChanTemp a = rgba[i][ACOMP] + It;
rgba[i][RCOMP] = MIN2(r, CHAN_MAX);
rgba[i][GCOMP] = MIN2(g, CHAN_MAX);
rgba[i][BCOMP] = MIN2(b, CHAN_MAX);
break;
case GL_RGB:
for (i=0;i<n;i++) {
- GLuint r = rgba[i][RCOMP] + texel[i][RCOMP];
- GLuint g = rgba[i][GCOMP] + texel[i][GCOMP];
- GLuint b = rgba[i][BCOMP] + texel[i][BCOMP];
+ ChanTemp r = rgba[i][RCOMP] + texel[i][RCOMP];
+ ChanTemp g = rgba[i][GCOMP] + texel[i][GCOMP];
+ ChanTemp b = rgba[i][BCOMP] + texel[i][BCOMP];
rgba[i][RCOMP] = MIN2(r, CHAN_MAX);
rgba[i][GCOMP] = MIN2(g, CHAN_MAX);
rgba[i][BCOMP] = MIN2(b, CHAN_MAX);
break;
case GL_RGBA:
for (i=0;i<n;i++) {
- GLuint r = rgba[i][RCOMP] + texel[i][RCOMP];
- GLuint g = rgba[i][GCOMP] + texel[i][GCOMP];
- GLuint b = rgba[i][BCOMP] + texel[i][BCOMP];
+ ChanTemp r = rgba[i][RCOMP] + texel[i][RCOMP];
+ ChanTemp g = rgba[i][GCOMP] + texel[i][GCOMP];
+ ChanTemp b = rgba[i][BCOMP] + texel[i][BCOMP];
rgba[i][RCOMP] = MIN2(r, CHAN_MAX);
rgba[i][GCOMP] = MIN2(g, CHAN_MAX);
rgba[i][BCOMP] = MIN2(b, CHAN_MAX);