diff options
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/accum.c | 24 | ||||
-rw-r--r-- | mesalib/src/mesa/main/fbobject.c | 69 | ||||
-rw-r--r-- | mesalib/src/mesa/main/format_unpack.c | 503 | ||||
-rw-r--r-- | mesalib/src/mesa/main/format_unpack.h | 7 | ||||
-rw-r--r-- | mesalib/src/mesa/main/formats.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/readpix.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/shaderapi.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/shared.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texstate.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/version.h | 6 |
10 files changed, 587 insertions, 32 deletions
diff --git a/mesalib/src/mesa/main/accum.c b/mesalib/src/mesa/main/accum.c index a8c30c223..df6f219bf 100644 --- a/mesalib/src/mesa/main/accum.c +++ b/mesalib/src/mesa/main/accum.c @@ -117,19 +117,6 @@ _mesa_init_accum_dispatch(struct _glapi_table *disp) } -#endif /* FEATURE_accum */ - - -void -_mesa_init_accum( struct gl_context *ctx ) -{ - /* Accumulate buffer group */ - ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 ); -} - - - - /** * Clear the accumulation buffer by mapping the renderbuffer and * writing the clear color to it. Called by the driver's implementation @@ -507,3 +494,14 @@ _mesa_accum(struct gl_context *ctx, GLenum op, GLfloat value) break; } } + + +#endif /* FEATURE_accum */ + + +void +_mesa_init_accum( struct gl_context *ctx ) +{ + /* Accumulate buffer group */ + ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 ); +} diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 912170aba..aefcaf350 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -2579,6 +2579,44 @@ find_attachment(const struct gl_framebuffer *fb, } +/** + * Helper function for checking if the datatypes of color buffers are + * compatible for glBlitFramebuffer. From the 3.1 spec, page 198: + * + * "GL_INVALID_OPERATION is generated if mask contains GL_COLOR_BUFFER_BIT + * and any of the following conditions hold: + * - The read buffer contains fixed-point or floating-point values and any + * draw buffer contains neither fixed-point nor floating-point values. + * - The read buffer contains unsigned integer values and any draw buffer + * does not contain unsigned integer values. + * - The read buffer contains signed integer values and any draw buffer + * does not contain signed integer values." + */ +static GLboolean +compatible_color_datatypes(gl_format srcFormat, gl_format dstFormat) +{ + GLenum srcType = _mesa_get_format_datatype(srcFormat); + GLenum dstType = _mesa_get_format_datatype(dstFormat); + + if (srcType != GL_INT && srcType != GL_UNSIGNED_INT) { + assert(srcType == GL_UNSIGNED_NORMALIZED || + srcType == GL_SIGNED_NORMALIZED || + srcType == GL_FLOAT); + /* Boil any of those types down to GL_FLOAT */ + srcType = GL_FLOAT; + } + + if (dstType != GL_INT && dstType != GL_UNSIGNED_INT) { + assert(dstType == GL_UNSIGNED_NORMALIZED || + dstType == GL_SIGNED_NORMALIZED || + dstType == GL_FLOAT); + /* Boil any of those types down to GL_FLOAT */ + dstType = GL_FLOAT; + } + + return srcType == dstType; +} + /** * Blit rectangular region, optionally from one framebuffer to another. @@ -2663,6 +2701,12 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, colorReadRb = colorDrawRb = NULL; mask &= ~GL_COLOR_BUFFER_BIT; } + else if (!compatible_color_datatypes(colorReadRb->Format, + colorDrawRb->Format)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebufferEXT(color buffer datatypes mismatch)"); + return; + } } else { colorReadRb = colorDrawRb = NULL; @@ -2683,10 +2727,9 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, if ((readRb == NULL) || (drawRb == NULL)) { mask &= ~GL_STENCIL_BUFFER_BIT; } - else if (_mesa_get_format_bits(readRb->Format, GL_STENCIL_BITS) != - _mesa_get_format_bits(drawRb->Format, GL_STENCIL_BITS)) { + else if (readRb->Format != drawRb->Format) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebufferEXT(stencil buffer size mismatch)"); + "glBlitFramebufferEXT(stencil buffer format mismatch)"); return; } } @@ -2706,10 +2749,9 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, if ((readRb == NULL) || (drawRb == NULL)) { mask &= ~GL_DEPTH_BUFFER_BIT; } - else if (_mesa_get_format_bits(readRb->Format, GL_DEPTH_BITS) != - _mesa_get_format_bits(drawRb->Format, GL_DEPTH_BITS)) { + else if (readRb->Format != drawRb->Format) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebufferEXT(depth buffer size mismatch)"); + "glBlitFramebufferEXT(depth buffer format mismatch)"); return; } } @@ -2718,7 +2760,7 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, drawFb->Visual.samples > 0 && readFb->Visual.samples != drawFb->Visual.samples) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebufferEXT(mismatched samples"); + "glBlitFramebufferEXT(mismatched samples)"); return; } @@ -2742,6 +2784,19 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, } } + if (filter == GL_LINEAR && (mask & GL_COLOR_BUFFER_BIT)) { + /* 3.1 spec, page 199: + * "Calling BlitFramebuffer will result in an INVALID_OPERATION error + * if filter is LINEAR and read buffer contains integer data." + */ + GLenum type = _mesa_get_format_datatype(colorReadRb->Format); + if (type == GL_INT || type == GL_UNSIGNED_INT) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebufferEXT(integer color type)"); + return; + } + } + if (!ctx->Extensions.EXT_framebuffer_blit) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT"); return; diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index a22ff5a61..ff98c69cd 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -29,6 +29,22 @@ #include "../../gallium/auxiliary/util/u_format_r11g11b10f.h" + +/* Expand 1, 2, 3, 4, 5, 6-bit values to fill 8 bits */ + +#define EXPAND_1_8(X) ( (X) ? 0xff : 0x0 ) + +#define EXPAND_2_8(X) ( ((X) << 6) | ((X) << 4) | ((X) << 2) | (X) ) + +#define EXPAND_3_8(X) ( ((X) << 5) | ((X) << 2) | ((X) >> 1) ) + +#define EXPAND_4_8(X) ( ((X) << 4) | (X) ) + +#define EXPAND_5_8(X) ( ((X) << 3) | ((X) >> 2) ) + +#define EXPAND_6_8(X) ( ((X) << 2) | ((X) >> 4) ) + + /** * Convert an 8-bit sRGB value from non-linear space to a * linear RGB value in [0, 1]. @@ -57,6 +73,10 @@ nonlinear_to_linear(GLubyte cs8) } +/**********************************************************************/ +/* Unpack, returning GLfloat colors */ +/**********************************************************************/ + typedef void (*unpack_rgba_func)(const void *src, GLfloat dst[][4], GLuint n); @@ -1566,6 +1586,9 @@ get_unpack_rgba_function(gl_format format) } +/** + * Unpack rgba colors, returning as GLfloat values. + */ void _mesa_unpack_rgba_row(gl_format format, GLuint n, const void *src, GLfloat dst[][4]) @@ -1574,6 +1597,482 @@ _mesa_unpack_rgba_row(gl_format format, GLuint n, unpack(src, dst, n); } + +/**********************************************************************/ +/* Unpack, returning GLubyte colors */ +/**********************************************************************/ + + +static void +unpack_ubyte_RGBA8888(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLuint *s = ((const GLuint *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (s[i] >> 24); + dst[i][GCOMP] = (s[i] >> 16) & 0xff; + dst[i][BCOMP] = (s[i] >> 8) & 0xff; + dst[i][ACOMP] = (s[i] ) & 0xff; + } +} + +static void +unpack_ubyte_RGBA8888_REV(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLuint *s = ((const GLuint *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (s[i] ) & 0xff; + dst[i][GCOMP] = (s[i] >> 8) & 0xff; + dst[i][BCOMP] = (s[i] >> 16) & 0xff; + dst[i][ACOMP] = (s[i] >> 24); + } +} + +static void +unpack_ubyte_ARGB8888(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLuint *s = ((const GLuint *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (s[i] >> 16) & 0xff; + dst[i][GCOMP] = (s[i] >> 8) & 0xff; + dst[i][BCOMP] = (s[i] ) & 0xff; + dst[i][ACOMP] = (s[i] >> 24); + } +} + +static void +unpack_ubyte_ARGB8888_REV(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLuint *s = ((const GLuint *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (s[i] >> 8) & 0xff; + dst[i][GCOMP] = (s[i] >> 16) & 0xff; + dst[i][BCOMP] = (s[i] >> 24); + dst[i][ACOMP] = (s[i] ) & 0xff; + } +} + +static void +unpack_ubyte_RGBX8888(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLuint *s = ((const GLuint *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (s[i] >> 24); + dst[i][GCOMP] = (s[i] >> 16) & 0xff; + dst[i][BCOMP] = (s[i] >> 8) & 0xff; + dst[i][ACOMP] = 0xff; + } +} + +static void +unpack_ubyte_RGBX8888_REV(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLuint *s = ((const GLuint *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (s[i] ) & 0xff; + dst[i][GCOMP] = (s[i] >> 8) & 0xff; + dst[i][BCOMP] = (s[i] >> 16) & 0xff; + dst[i][ACOMP] = 0xff; + } +} + +static void +unpack_ubyte_XRGB8888(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLuint *s = ((const GLuint *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (s[i] >> 16) & 0xff; + dst[i][GCOMP] = (s[i] >> 8) & 0xff; + dst[i][BCOMP] = (s[i] ) & 0xff; + dst[i][ACOMP] = 0xff; + } +} + +static void +unpack_ubyte_XRGB8888_REV(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLuint *s = ((const GLuint *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (s[i] >> 8) & 0xff; + dst[i][GCOMP] = (s[i] >> 16) & 0xff; + dst[i][BCOMP] = (s[i] >> 24); + dst[i][ACOMP] = 0xff; + } +} + +static void +unpack_ubyte_RGB888(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLubyte *s = (const GLubyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = s[i*3+2]; + dst[i][GCOMP] = s[i*3+1]; + dst[i][BCOMP] = s[i*3+0]; + dst[i][ACOMP] = 0xff; + } +} + +static void +unpack_ubyte_BGR888(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLubyte *s = (const GLubyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = s[i*3+0]; + dst[i][GCOMP] = s[i*3+1]; + dst[i][BCOMP] = s[i*3+2]; + dst[i][ACOMP] = 0xff; + } +} + +static void +unpack_ubyte_RGB565(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLushort *s = ((const GLushort *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = EXPAND_5_8((s[i] >> 11) & 0x1f); + dst[i][GCOMP] = EXPAND_6_8((s[i] >> 5 ) & 0x3f); + dst[i][BCOMP] = EXPAND_5_8( s[i] & 0x1f); + dst[i][ACOMP] = 0xff; + } +} + +static void +unpack_ubyte_RGB565_REV(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLushort *s = ((const GLushort *) src); + GLuint i; + for (i = 0; i < n; i++) { + GLuint t = (s[i] >> 8) | (s[i] << 8); /* byte swap */ + dst[i][RCOMP] = EXPAND_5_8((t >> 11) & 0x1f); + dst[i][GCOMP] = EXPAND_6_8((t >> 5 ) & 0x3f); + dst[i][BCOMP] = EXPAND_5_8( t & 0x1f); + dst[i][ACOMP] = 0xff; + } +} + +static void +unpack_ubyte_ARGB4444(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLushort *s = ((const GLushort *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = EXPAND_4_8((s[i] >> 8) & 0xf); + dst[i][GCOMP] = EXPAND_4_8((s[i] >> 4) & 0xf); + dst[i][BCOMP] = EXPAND_4_8((s[i] ) & 0xf); + dst[i][ACOMP] = EXPAND_4_8((s[i] >> 12) & 0xf); + } +} + +static void +unpack_ubyte_ARGB4444_REV(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLushort *s = ((const GLushort *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = EXPAND_4_8((s[i] ) & 0xf); + dst[i][GCOMP] = EXPAND_4_8((s[i] >> 12) & 0xf); + dst[i][BCOMP] = EXPAND_4_8((s[i] >> 8) & 0xf); + dst[i][ACOMP] = EXPAND_4_8((s[i] >> 4) & 0xf); + } +} + +static void +unpack_ubyte_RGBA5551(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLushort *s = ((const GLushort *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = EXPAND_5_8((s[i] >> 11) & 0x1f); + dst[i][GCOMP] = EXPAND_5_8((s[i] >> 6) & 0x1f); + dst[i][BCOMP] = EXPAND_5_8((s[i] >> 1) & 0x1f); + dst[i][ACOMP] = EXPAND_1_8((s[i] ) & 0x01); + } +} + +static void +unpack_ubyte_ARGB1555(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLushort *s = ((const GLushort *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = EXPAND_5_8((s[i] >> 10) & 0x1f); + dst[i][GCOMP] = EXPAND_5_8((s[i] >> 5) & 0x1f); + dst[i][BCOMP] = EXPAND_5_8((s[i] >> 0) & 0x1f); + dst[i][ACOMP] = EXPAND_1_8((s[i] >> 15) & 0x01); + } +} + +static void +unpack_ubyte_ARGB1555_REV(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLushort *s = ((const GLushort *) src); + GLuint i; + for (i = 0; i < n; i++) { + GLushort tmp = (s[i] << 8) | (s[i] >> 8); /* byteswap */ + dst[i][RCOMP] = EXPAND_5_8((tmp >> 10) & 0x1f); + dst[i][GCOMP] = EXPAND_5_8((tmp >> 5) & 0x1f); + dst[i][BCOMP] = EXPAND_5_8((tmp >> 0) & 0x1f); + dst[i][ACOMP] = EXPAND_1_8((tmp >> 15) & 0x01); + } +} + +static void +unpack_ubyte_AL44(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLubyte *s = ((const GLubyte *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = EXPAND_4_8(s[i] & 0xf); + dst[i][ACOMP] = EXPAND_4_8(s[i] >> 4); + } +} + +static void +unpack_ubyte_AL88(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLushort *s = ((const GLushort *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = EXPAND_4_8(s[i] & 0xff); + dst[i][ACOMP] = EXPAND_4_8(s[i] >> 8); + } +} + +static void +unpack_ubyte_AL88_REV(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLushort *s = ((const GLushort *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = EXPAND_4_8(s[i] >> 8); + dst[i][ACOMP] = EXPAND_4_8(s[i] & 0xff); + } +} + +static void +unpack_ubyte_RGB332(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLubyte *s = ((const GLubyte *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = EXPAND_3_8((s[i] >> 5) & 0x7); + dst[i][GCOMP] = EXPAND_3_8((s[i] >> 2) & 0x7); + dst[i][BCOMP] = EXPAND_2_8((s[i] ) & 0x3); + dst[i][ACOMP] = 0xff; + } +} + +static void +unpack_ubyte_A8(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLubyte *s = ((const GLubyte *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = 0; + dst[i][ACOMP] = s[i]; + } +} + +static void +unpack_ubyte_L8(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLubyte *s = ((const GLubyte *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = s[i]; + dst[i][ACOMP] = 0xff; + } +} + + +static void +unpack_ubyte_I8(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLubyte *s = ((const GLubyte *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = + dst[i][ACOMP] = s[i]; + } +} + +static void +unpack_ubyte_R8(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLubyte *s = ((const GLubyte *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][0] = s[i]; + dst[i][1] = + dst[i][2] = 0; + dst[i][3] = 0xff; + } +} + +static void +unpack_ubyte_GR88(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLushort *s = ((const GLushort *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = s[i] & 0xff; + dst[i][GCOMP] = s[i] >> 8; + dst[i][BCOMP] = 0; + dst[i][ACOMP] = 0xff; + } +} + +static void +unpack_ubyte_RG88(const void *src, GLubyte dst[][4], GLuint n) +{ + const GLushort *s = ((const GLushort *) src); + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = s[i] >> 8; + dst[i][GCOMP] = s[i] & 0xff; + dst[i][BCOMP] = 0; + dst[i][ACOMP] = 0xff; + } +} + + +/** + * Unpack rgba colors, returning as GLubyte values. This should usually + * only be used for unpacking formats that use 8 bits or less per channel. + */ +void +_mesa_unpack_ubyte_rgba_row(gl_format format, GLuint n, + const void *src, GLubyte dst[][4]) +{ + switch (format) { + case MESA_FORMAT_RGBA8888: + unpack_ubyte_RGBA8888(src, dst, n); + break; + case MESA_FORMAT_RGBA8888_REV: + unpack_ubyte_RGBA8888_REV(src, dst, n); + break; + case MESA_FORMAT_ARGB8888: + unpack_ubyte_ARGB8888(src, dst, n); + break; + case MESA_FORMAT_ARGB8888_REV: + unpack_ubyte_ARGB8888_REV(src, dst, n); + break; + case MESA_FORMAT_RGBX8888: + unpack_ubyte_RGBX8888(src, dst, n); + break; + case MESA_FORMAT_RGBX8888_REV: + unpack_ubyte_RGBX8888_REV(src, dst, n); + break; + case MESA_FORMAT_XRGB8888: + unpack_ubyte_XRGB8888(src, dst, n); + break; + case MESA_FORMAT_XRGB8888_REV: + unpack_ubyte_XRGB8888_REV(src, dst, n); + break; + case MESA_FORMAT_RGB888: + unpack_ubyte_RGB888(src, dst, n); + break; + case MESA_FORMAT_BGR888: + unpack_ubyte_BGR888(src, dst, n); + break; + case MESA_FORMAT_RGB565: + unpack_ubyte_RGB565(src, dst, n); + break; + case MESA_FORMAT_RGB565_REV: + unpack_ubyte_RGB565_REV(src, dst, n); + break; + case MESA_FORMAT_ARGB4444: + unpack_ubyte_ARGB4444(src, dst, n); + break; + case MESA_FORMAT_ARGB4444_REV: + unpack_ubyte_ARGB4444_REV(src, dst, n); + break; + case MESA_FORMAT_RGBA5551: + unpack_ubyte_RGBA5551(src, dst, n); + break; + case MESA_FORMAT_ARGB1555: + unpack_ubyte_ARGB1555(src, dst, n); + break; + case MESA_FORMAT_ARGB1555_REV: + unpack_ubyte_ARGB1555_REV(src, dst, n); + break; + case MESA_FORMAT_AL44: + unpack_ubyte_AL44(src, dst, n); + break; + case MESA_FORMAT_AL88: + unpack_ubyte_AL88(src, dst, n); + break; + case MESA_FORMAT_AL88_REV: + unpack_ubyte_AL88_REV(src, dst, n); + break; + case MESA_FORMAT_RGB332: + unpack_ubyte_RGB332(src, dst, n); + break; + case MESA_FORMAT_A8: + unpack_ubyte_A8(src, dst, n); + break; + case MESA_FORMAT_L8: + unpack_ubyte_L8(src, dst, n); + break; + case MESA_FORMAT_I8: + unpack_ubyte_I8(src, dst, n); + break; + case MESA_FORMAT_R8: + unpack_ubyte_R8(src, dst, n); + break; + case MESA_FORMAT_GR88: + unpack_ubyte_GR88(src, dst, n); + break; + case MESA_FORMAT_RG88: + unpack_ubyte_RG88(src, dst, n); + break; + default: + /* get float values, convert to ubyte */ + { + GLfloat *tmp = (GLfloat *) malloc(n * 4 * sizeof(GLfloat)); + if (tmp) { + GLuint i; + _mesa_unpack_rgba_row(format, n, src, (GLfloat (*)[4]) tmp); + for (i = 0; i < n; i++) { + UNCLAMPED_FLOAT_TO_UBYTE(dst[i][0], tmp[i*4+0]); + UNCLAMPED_FLOAT_TO_UBYTE(dst[i][1], tmp[i*4+1]); + UNCLAMPED_FLOAT_TO_UBYTE(dst[i][2], tmp[i*4+2]); + UNCLAMPED_FLOAT_TO_UBYTE(dst[i][3], tmp[i*4+3]); + } + free(tmp); + } + } + break; + } +} + + +/**********************************************************************/ +/* Unpack, returning GLuint colors */ +/**********************************************************************/ + static void unpack_int_rgba_RGBA_UINT32(const GLuint *src, GLuint dst[][4], GLuint n) { @@ -1770,8 +2269,8 @@ unpack_int_rgba_ARGB2101010_UINT(const GLuint *src, GLuint dst[][4], GLuint n) } void -_mesa_unpack_int_rgba_row(gl_format format, GLuint n, - const void *src, GLuint dst[][4]) +_mesa_unpack_uint_rgba_row(gl_format format, GLuint n, + const void *src, GLuint dst[][4]) { switch (format) { /* Since there won't be any sign extension happening, there's no need to diff --git a/mesalib/src/mesa/main/format_unpack.h b/mesalib/src/mesa/main/format_unpack.h index c5348d30d..aad800dd1 100644 --- a/mesalib/src/mesa/main/format_unpack.h +++ b/mesalib/src/mesa/main/format_unpack.h @@ -28,10 +28,13 @@ extern void _mesa_unpack_rgba_row(gl_format format, GLuint n, const void *src, GLfloat dst[][4]); +extern void +_mesa_unpack_ubyte_rgba_row(gl_format format, GLuint n, + const void *src, GLubyte dst[][4]); void -_mesa_unpack_int_rgba_row(gl_format format, GLuint n, - const void *src, GLuint dst[][4]); +_mesa_unpack_uint_rgba_row(gl_format format, GLuint n, + const void *src, GLuint dst[][4]); extern void _mesa_unpack_rgba_block(gl_format format, diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index cca0014b1..96317dbf4 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -1951,7 +1951,7 @@ _mesa_test_formats(void) { GLuint i; - assert(Elements(format_info) == MESA_FORMAT_COUNT); + STATIC_ASSERT(Elements(format_info) == MESA_FORMAT_COUNT); for (i = 0; i < MESA_FORMAT_COUNT; i++) { const struct gl_format_info *info = _mesa_get_format_info(i); diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index 38b9c64ed..0c0e5394d 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -273,7 +273,7 @@ slow_read_rgba_pixels( struct gl_context *ctx, for (j = 0; j < height; j++) { if (_mesa_is_integer_format(format)) { - _mesa_unpack_int_rgba_row(rbFormat, width, map, (GLuint (*)[4]) rgba); + _mesa_unpack_uint_rgba_row(rbFormat, width, map, (GLuint (*)[4]) rgba); _mesa_pack_rgba_span_int(ctx, width, (GLuint (*)[4]) rgba, format, type, dst); } else { diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 52a9bd452..9372d6dec 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -923,7 +923,7 @@ validate_samplers(const struct gl_program *prog, char *errMsg) GLbitfield samplersUsed = prog->SamplersUsed; GLuint i; - assert(Elements(targetName) == NUM_TEXTURE_TARGETS); + STATIC_ASSERT(Elements(targetName) == NUM_TEXTURE_TARGETS); if (samplersUsed == 0x0) return GL_TRUE; diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c index 276fac149..c3e93b5a5 100644 --- a/mesalib/src/mesa/main/shared.c +++ b/mesalib/src/mesa/main/shared.c @@ -113,7 +113,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx) GL_TEXTURE_2D, GL_TEXTURE_1D }; - assert(Elements(targets) == NUM_TEXTURE_TARGETS); + STATIC_ASSERT(Elements(targets) == NUM_TEXTURE_TARGETS); shared->DefaultTex[i] = ctx->Driver.NewTextureObject(ctx, 0, targets[i]); } diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c index 7cd285803..8e9537fae 100644 --- a/mesalib/src/mesa/main/texstate.c +++ b/mesalib/src/mesa/main/texstate.c @@ -695,7 +695,7 @@ alloc_proxy_textures( struct gl_context *ctx ) }; GLint tgt; - ASSERT(Elements(targets) == NUM_TEXTURE_TARGETS); + STATIC_ASSERT(Elements(targets) == NUM_TEXTURE_TARGETS); for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { if (!(ctx->Texture.ProxyTex[tgt] diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h index 32e141f0e..d288c4d55 100644 --- a/mesalib/src/mesa/main/version.h +++ b/mesalib/src/mesa/main/version.h @@ -32,10 +32,10 @@ struct gl_context; /* Mesa version */ -#define MESA_MAJOR 7 -#define MESA_MINOR 12 +#define MESA_MAJOR 8 +#define MESA_MINOR 0 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.12-devel" +#define MESA_VERSION_STRING "8.0-devel" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |