if (dstFormat == GL_RGB) {
GLubyte *dst = (GLubyte *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 7.0F) << 5)
- | (IROUND(rgba[i][GCOMP] * 7.0F) << 2)
- | (IROUND(rgba[i][BCOMP] * 3.0F) );
+ dst[i] = (F_TO_I(rgba[i][RCOMP] * 7.0F) << 5)
+ | (F_TO_I(rgba[i][GCOMP] * 7.0F) << 2)
+ | (F_TO_I(rgba[i][BCOMP] * 3.0F) );
}
}
break;
if (dstFormat == GL_RGB) {
GLubyte *dst = (GLubyte *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 7.0F) )
- | (IROUND(rgba[i][GCOMP] * 7.0F) << 3)
- | (IROUND(rgba[i][BCOMP] * 3.0F) << 6);
+ dst[i] = (F_TO_I(rgba[i][RCOMP] * 7.0F) )
+ | (F_TO_I(rgba[i][GCOMP] * 7.0F) << 3)
+ | (F_TO_I(rgba[i][BCOMP] * 3.0F) << 6);
}
}
break;
if (dstFormat == GL_RGB) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 31.0F) << 11)
- | (IROUND(rgba[i][GCOMP] * 63.0F) << 5)
- | (IROUND(rgba[i][BCOMP] * 31.0F) );
+ dst[i] = (F_TO_I(rgba[i][RCOMP] * 31.0F) << 11)
+ | (F_TO_I(rgba[i][GCOMP] * 63.0F) << 5)
+ | (F_TO_I(rgba[i][BCOMP] * 31.0F) );
}
}
break;
if (dstFormat == GL_RGB) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 31.0F) )
- | (IROUND(rgba[i][GCOMP] * 63.0F) << 5)
- | (IROUND(rgba[i][BCOMP] * 31.0F) << 11);
+ dst[i] = (F_TO_I(rgba[i][RCOMP] * 31.0F) )
+ | (F_TO_I(rgba[i][GCOMP] * 63.0F) << 5)
+ | (F_TO_I(rgba[i][BCOMP] * 31.0F) << 11);
}
}
break;
if (dstFormat == GL_RGBA) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 15.0F) << 12)
- | (IROUND(rgba[i][GCOMP] * 15.0F) << 8)
- | (IROUND(rgba[i][BCOMP] * 15.0F) << 4)
- | (IROUND(rgba[i][ACOMP] * 15.0F) );
+ dst[i] = (F_TO_I(rgba[i][RCOMP] * 15.0F) << 12)
+ | (F_TO_I(rgba[i][GCOMP] * 15.0F) << 8)
+ | (F_TO_I(rgba[i][BCOMP] * 15.0F) << 4)
+ | (F_TO_I(rgba[i][ACOMP] * 15.0F) );
}
}
else if (dstFormat == GL_BGRA) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 15.0F) << 12)
- | (IROUND(rgba[i][GCOMP] * 15.0F) << 8)
- | (IROUND(rgba[i][RCOMP] * 15.0F) << 4)
- | (IROUND(rgba[i][ACOMP] * 15.0F) );
+ dst[i] = (F_TO_I(rgba[i][BCOMP] * 15.0F) << 12)
+ | (F_TO_I(rgba[i][GCOMP] * 15.0F) << 8)
+ | (F_TO_I(rgba[i][RCOMP] * 15.0F) << 4)
+ | (F_TO_I(rgba[i][ACOMP] * 15.0F) );
}
}
else if (dstFormat == GL_ABGR_EXT) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 15.0F) << 12)
- | (IROUND(rgba[i][BCOMP] * 15.0F) << 8)
- | (IROUND(rgba[i][GCOMP] * 15.0F) << 4)
- | (IROUND(rgba[i][RCOMP] * 15.0F) );
+ dst[i] = (F_TO_I(rgba[i][ACOMP] * 15.0F) << 12)
+ | (F_TO_I(rgba[i][BCOMP] * 15.0F) << 8)
+ | (F_TO_I(rgba[i][GCOMP] * 15.0F) << 4)
+ | (F_TO_I(rgba[i][RCOMP] * 15.0F) );
}
}
break;
if (dstFormat == GL_RGBA) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 15.0F) )
- | (IROUND(rgba[i][GCOMP] * 15.0F) << 4)
- | (IROUND(rgba[i][BCOMP] * 15.0F) << 8)
- | (IROUND(rgba[i][ACOMP] * 15.0F) << 12);
+ dst[i] = (F_TO_I(rgba[i][RCOMP] * 15.0F) )
+ | (F_TO_I(rgba[i][GCOMP] * 15.0F) << 4)
+ | (F_TO_I(rgba[i][BCOMP] * 15.0F) << 8)
+ | (F_TO_I(rgba[i][ACOMP] * 15.0F) << 12);
}
}
else if (dstFormat == GL_BGRA) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 15.0F) )
- | (IROUND(rgba[i][GCOMP] * 15.0F) << 4)
- | (IROUND(rgba[i][RCOMP] * 15.0F) << 8)
- | (IROUND(rgba[i][ACOMP] * 15.0F) << 12);
+ dst[i] = (F_TO_I(rgba[i][BCOMP] * 15.0F) )
+ | (F_TO_I(rgba[i][GCOMP] * 15.0F) << 4)
+ | (F_TO_I(rgba[i][RCOMP] * 15.0F) << 8)
+ | (F_TO_I(rgba[i][ACOMP] * 15.0F) << 12);
}
}
else if (dstFormat == GL_ABGR_EXT) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 15.0F) )
- | (IROUND(rgba[i][BCOMP] * 15.0F) << 4)
- | (IROUND(rgba[i][GCOMP] * 15.0F) << 8)
- | (IROUND(rgba[i][RCOMP] * 15.0F) << 12);
+ dst[i] = (F_TO_I(rgba[i][ACOMP] * 15.0F) )
+ | (F_TO_I(rgba[i][BCOMP] * 15.0F) << 4)
+ | (F_TO_I(rgba[i][GCOMP] * 15.0F) << 8)
+ | (F_TO_I(rgba[i][RCOMP] * 15.0F) << 12);
}
}
break;
if (dstFormat == GL_RGBA) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 31.0F) << 11)
- | (IROUND(rgba[i][GCOMP] * 31.0F) << 6)
- | (IROUND(rgba[i][BCOMP] * 31.0F) << 1)
- | (IROUND(rgba[i][ACOMP] * 1.0F) );
+ dst[i] = (F_TO_I(rgba[i][RCOMP] * 31.0F) << 11)
+ | (F_TO_I(rgba[i][GCOMP] * 31.0F) << 6)
+ | (F_TO_I(rgba[i][BCOMP] * 31.0F) << 1)
+ | (F_TO_I(rgba[i][ACOMP] * 1.0F) );
}
}
else if (dstFormat == GL_BGRA) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 31.0F) << 11)
- | (IROUND(rgba[i][GCOMP] * 31.0F) << 6)
- | (IROUND(rgba[i][RCOMP] * 31.0F) << 1)
- | (IROUND(rgba[i][ACOMP] * 1.0F) );
+ dst[i] = (F_TO_I(rgba[i][BCOMP] * 31.0F) << 11)
+ | (F_TO_I(rgba[i][GCOMP] * 31.0F) << 6)
+ | (F_TO_I(rgba[i][RCOMP] * 31.0F) << 1)
+ | (F_TO_I(rgba[i][ACOMP] * 1.0F) );
}
}
else if (dstFormat == GL_ABGR_EXT) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 31.0F) << 11)
- | (IROUND(rgba[i][BCOMP] * 31.0F) << 6)
- | (IROUND(rgba[i][GCOMP] * 31.0F) << 1)
- | (IROUND(rgba[i][RCOMP] * 1.0F) );
+ dst[i] = (F_TO_I(rgba[i][ACOMP] * 31.0F) << 11)
+ | (F_TO_I(rgba[i][BCOMP] * 31.0F) << 6)
+ | (F_TO_I(rgba[i][GCOMP] * 31.0F) << 1)
+ | (F_TO_I(rgba[i][RCOMP] * 1.0F) );
}
}
break;
if (dstFormat == GL_RGBA) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 31.0F) )
- | (IROUND(rgba[i][GCOMP] * 31.0F) << 5)
- | (IROUND(rgba[i][BCOMP] * 31.0F) << 10)
- | (IROUND(rgba[i][ACOMP] * 1.0F) << 15);
+ dst[i] = (F_TO_I(rgba[i][RCOMP] * 31.0F) )
+ | (F_TO_I(rgba[i][GCOMP] * 31.0F) << 5)
+ | (F_TO_I(rgba[i][BCOMP] * 31.0F) << 10)
+ | (F_TO_I(rgba[i][ACOMP] * 1.0F) << 15);
}
}
else if (dstFormat == GL_BGRA) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 31.0F) )
- | (IROUND(rgba[i][GCOMP] * 31.0F) << 5)
- | (IROUND(rgba[i][RCOMP] * 31.0F) << 10)
- | (IROUND(rgba[i][ACOMP] * 1.0F) << 15);
+ dst[i] = (F_TO_I(rgba[i][BCOMP] * 31.0F) )
+ | (F_TO_I(rgba[i][GCOMP] * 31.0F) << 5)
+ | (F_TO_I(rgba[i][RCOMP] * 31.0F) << 10)
+ | (F_TO_I(rgba[i][ACOMP] * 1.0F) << 15);
}
}
else if (dstFormat == GL_ABGR_EXT) {
GLushort *dst = (GLushort *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 31.0F) )
- | (IROUND(rgba[i][BCOMP] * 31.0F) << 5)
- | (IROUND(rgba[i][GCOMP] * 31.0F) << 10)
- | (IROUND(rgba[i][RCOMP] * 1.0F) << 15);
+ dst[i] = (F_TO_I(rgba[i][ACOMP] * 31.0F) )
+ | (F_TO_I(rgba[i][BCOMP] * 31.0F) << 5)
+ | (F_TO_I(rgba[i][GCOMP] * 31.0F) << 10)
+ | (F_TO_I(rgba[i][RCOMP] * 1.0F) << 15);
}
}
break;
if (dstFormat == GL_RGBA) {
GLuint *dst = (GLuint *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 255.F) << 24)
- | (IROUND(rgba[i][GCOMP] * 255.F) << 16)
- | (IROUND(rgba[i][BCOMP] * 255.F) << 8)
- | (IROUND(rgba[i][ACOMP] * 255.F) );
+ dst[i] = (F_TO_I(rgba[i][RCOMP] * 255.F) << 24)
+ | (F_TO_I(rgba[i][GCOMP] * 255.F) << 16)
+ | (F_TO_I(rgba[i][BCOMP] * 255.F) << 8)
+ | (F_TO_I(rgba[i][ACOMP] * 255.F) );
}
}
else if (dstFormat == GL_BGRA) {
GLuint *dst = (GLuint *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 255.F) << 24)
- | (IROUND(rgba[i][GCOMP] * 255.F) << 16)
- | (IROUND(rgba[i][RCOMP] * 255.F) << 8)
- | (IROUND(rgba[i][ACOMP] * 255.F) );
+ dst[i] = (F_TO_I(rgba[i][BCOMP] * 255.F) << 24)
+ | (F_TO_I(rgba[i][GCOMP] * 255.F) << 16)
+ | (F_TO_I(rgba[i][RCOMP] * 255.F) << 8)
+ | (F_TO_I(rgba[i][ACOMP] * 255.F) );
}
}
else if (dstFormat == GL_ABGR_EXT) {
GLuint *dst = (GLuint *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 255.F) << 24)
- | (IROUND(rgba[i][BCOMP] * 255.F) << 16)
- | (IROUND(rgba[i][GCOMP] * 255.F) << 8)
- | (IROUND(rgba[i][RCOMP] * 255.F) );
+ dst[i] = (F_TO_I(rgba[i][ACOMP] * 255.F) << 24)
+ | (F_TO_I(rgba[i][BCOMP] * 255.F) << 16)
+ | (F_TO_I(rgba[i][GCOMP] * 255.F) << 8)
+ | (F_TO_I(rgba[i][RCOMP] * 255.F) );
}
}
break;
if (dstFormat == GL_RGBA) {
GLuint *dst = (GLuint *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 255.0F) )
- | (IROUND(rgba[i][GCOMP] * 255.0F) << 8)
- | (IROUND(rgba[i][BCOMP] * 255.0F) << 16)
- | (IROUND(rgba[i][ACOMP] * 255.0F) << 24);
+ dst[i] = (F_TO_I(rgba[i][RCOMP] * 255.0F) )
+ | (F_TO_I(rgba[i][GCOMP] * 255.0F) << 8)
+ | (F_TO_I(rgba[i][BCOMP] * 255.0F) << 16)
+ | (F_TO_I(rgba[i][ACOMP] * 255.0F) << 24);
}
}
else if (dstFormat == GL_BGRA) {
GLuint *dst = (GLuint *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 255.0F) )
- | (IROUND(rgba[i][GCOMP] * 255.0F) << 8)
- | (IROUND(rgba[i][RCOMP] * 255.0F) << 16)
- | (IROUND(rgba[i][ACOMP] * 255.0F) << 24);
+ dst[i] = (F_TO_I(rgba[i][BCOMP] * 255.0F) )
+ | (F_TO_I(rgba[i][GCOMP] * 255.0F) << 8)
+ | (F_TO_I(rgba[i][RCOMP] * 255.0F) << 16)
+ | (F_TO_I(rgba[i][ACOMP] * 255.0F) << 24);
}
}
else if (dstFormat == GL_ABGR_EXT) {
GLuint *dst = (GLuint *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 255.0F) )
- | (IROUND(rgba[i][BCOMP] * 255.0F) << 8)
- | (IROUND(rgba[i][GCOMP] * 255.0F) << 16)
- | (IROUND(rgba[i][RCOMP] * 255.0F) << 24);
+ dst[i] = (F_TO_I(rgba[i][ACOMP] * 255.0F) )
+ | (F_TO_I(rgba[i][BCOMP] * 255.0F) << 8)
+ | (F_TO_I(rgba[i][GCOMP] * 255.0F) << 16)
+ | (F_TO_I(rgba[i][RCOMP] * 255.0F) << 24);
}
}
break;
if (dstFormat == GL_RGBA) {
GLuint *dst = (GLuint *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 1023.0F) << 22)
- | (IROUND(rgba[i][GCOMP] * 1023.0F) << 12)
- | (IROUND(rgba[i][BCOMP] * 1023.0F) << 2)
- | (IROUND(rgba[i][ACOMP] * 3.0F) );
+ dst[i] = (F_TO_I(rgba[i][RCOMP] * 1023.0F) << 22)
+ | (F_TO_I(rgba[i][GCOMP] * 1023.0F) << 12)
+ | (F_TO_I(rgba[i][BCOMP] * 1023.0F) << 2)
+ | (F_TO_I(rgba[i][ACOMP] * 3.0F) );
}
}
else if (dstFormat == GL_BGRA) {
GLuint *dst = (GLuint *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 1023.0F) << 22)
- | (IROUND(rgba[i][GCOMP] * 1023.0F) << 12)
- | (IROUND(rgba[i][RCOMP] * 1023.0F) << 2)
- | (IROUND(rgba[i][ACOMP] * 3.0F) );
+ dst[i] = (F_TO_I(rgba[i][BCOMP] * 1023.0F) << 22)
+ | (F_TO_I(rgba[i][GCOMP] * 1023.0F) << 12)
+ | (F_TO_I(rgba[i][RCOMP] * 1023.0F) << 2)
+ | (F_TO_I(rgba[i][ACOMP] * 3.0F) );
}
}
else if (dstFormat == GL_ABGR_EXT) {
GLuint *dst = (GLuint *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 1023.0F) << 22)
- | (IROUND(rgba[i][BCOMP] * 1023.0F) << 12)
- | (IROUND(rgba[i][GCOMP] * 1023.0F) << 2)
- | (IROUND(rgba[i][RCOMP] * 3.0F) );
+ dst[i] = (F_TO_I(rgba[i][ACOMP] * 1023.0F) << 22)
+ | (F_TO_I(rgba[i][BCOMP] * 1023.0F) << 12)
+ | (F_TO_I(rgba[i][GCOMP] * 1023.0F) << 2)
+ | (F_TO_I(rgba[i][RCOMP] * 3.0F) );
}
}
break;
if (dstFormat == GL_RGBA) {
GLuint *dst = (GLuint *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][RCOMP] * 1023.0F) )
- | (IROUND(rgba[i][GCOMP] * 1023.0F) << 10)
- | (IROUND(rgba[i][BCOMP] * 1023.0F) << 20)
- | (IROUND(rgba[i][ACOMP] * 3.0F) << 30);
+ dst[i] = (F_TO_I(rgba[i][RCOMP] * 1023.0F) )
+ | (F_TO_I(rgba[i][GCOMP] * 1023.0F) << 10)
+ | (F_TO_I(rgba[i][BCOMP] * 1023.0F) << 20)
+ | (F_TO_I(rgba[i][ACOMP] * 3.0F) << 30);
}
}
else if (dstFormat == GL_BGRA) {
GLuint *dst = (GLuint *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][BCOMP] * 1023.0F) )
- | (IROUND(rgba[i][GCOMP] * 1023.0F) << 10)
- | (IROUND(rgba[i][RCOMP] * 1023.0F) << 20)
- | (IROUND(rgba[i][ACOMP] * 3.0F) << 30);
+ dst[i] = (F_TO_I(rgba[i][BCOMP] * 1023.0F) )
+ | (F_TO_I(rgba[i][GCOMP] * 1023.0F) << 10)
+ | (F_TO_I(rgba[i][RCOMP] * 1023.0F) << 20)
+ | (F_TO_I(rgba[i][ACOMP] * 3.0F) << 30);
}
}
else if (dstFormat == GL_ABGR_EXT) {
GLuint *dst = (GLuint *) dstAddr;
for (i=0;i<n;i++) {
- dst[i] = (IROUND(rgba[i][ACOMP] * 1023.0F) )
- | (IROUND(rgba[i][BCOMP] * 1023.0F) << 10)
- | (IROUND(rgba[i][GCOMP] * 1023.0F) << 20)
- | (IROUND(rgba[i][RCOMP] * 3.0F) << 30);
+ dst[i] = (F_TO_I(rgba[i][ACOMP] * 1023.0F) )
+ | (F_TO_I(rgba[i][BCOMP] * 1023.0F) << 10)
+ | (F_TO_I(rgba[i][GCOMP] * 1023.0F) << 20)
+ | (F_TO_I(rgba[i][RCOMP] * 3.0F) << 30);
}
}
break;
static inline GLuint
clamp_float_to_uint(GLfloat f)
{
- return f < 0.0F ? 0 : IROUND(f);
+ return f < 0.0F ? 0 : F_TO_I(f);
}
clamp_half_to_uint(GLhalfARB h)
{
GLfloat f = _mesa_half_to_float(h);
- return f < 0.0F ? 0 : IROUND(f);
+ return f < 0.0F ? 0 : F_TO_I(f);
}