From a0b4a1330be6a36ad095222d2ea83927cd33514d Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 25 Nov 2011 08:22:48 +0100 Subject: mesa xserver pixman git update 25 nov 2011 --- mesalib/src/mesa/main/extensions.c | 4 +- mesalib/src/mesa/main/format_unpack.c | 14 +++- mesalib/src/mesa/main/formats.c | 12 ++-- mesalib/src/mesa/main/mtypes.h | 2 +- mesalib/src/mesa/main/readpix.c | 4 +- mesalib/src/mesa/main/texformat.c | 12 ++++ mesalib/src/mesa/main/teximage.c | 11 +--- mesalib/src/mesa/main/texparam.c | 119 ++++++++++++++++++++-------------- mesalib/src/mesa/main/texstore.c | 7 +- 9 files changed, 112 insertions(+), 73 deletions(-) (limited to 'mesalib/src/mesa/main') diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index d5a891435..8ebc05139 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -81,7 +81,7 @@ static const struct extension extension_table[] = { { "GL_ARB_blend_func_extended", o(ARB_blend_func_extended), GL, 2009 }, { "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), GL, 2004 }, { "GL_ARB_copy_buffer", o(ARB_copy_buffer), GL, 2008 }, - { "GL_ARB_conservative_depth", o(AMD_conservative_depth), GL, 2011 }, + { "GL_ARB_conservative_depth", o(ARB_conservative_depth), GL, 2011 }, { "GL_ARB_depth_buffer_float", o(ARB_depth_buffer_float), GL, 2008 }, { "GL_ARB_depth_clamp", o(ARB_depth_clamp), GL, 2003 }, { "GL_ARB_depth_texture", o(ARB_depth_texture), GL, 2001 }, @@ -257,7 +257,7 @@ static const struct extension extension_table[] = { /* Vendor extensions */ { "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), GL, 1999 }, - { "GL_AMD_conservative_depth", o(AMD_conservative_depth), GL, 2009 }, + { "GL_AMD_conservative_depth", o(ARB_conservative_depth), GL, 2009 }, { "GL_AMD_draw_buffers_blend", o(ARB_draw_buffers_blend), GL, 2009 }, { "GL_AMD_seamless_cubemap_per_texture", o(AMD_seamless_cubemap_per_texture), GL, 2009 }, { "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 }, diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index 6e2ce7a05..080392f2b 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -936,7 +936,7 @@ unpack_INTENSITY_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = - dst[i][ACOMP] = s[i]; + dst[i][ACOMP] = _mesa_half_to_float(s[i]); } } @@ -1750,6 +1750,12 @@ unpack_float_z_Z32(GLuint n, const void *src, GLfloat *dst) } } +static void +unpack_float_z_Z32F(GLuint n, const void *src, GLfloat *dst) +{ + memcpy(dst, src, n * sizeof(float)); +} + static void unpack_float_z_Z32X24S8(GLuint n, const void *src, GLfloat *dst) { @@ -1783,6 +1789,9 @@ _mesa_unpack_float_z_row(gl_format format, GLuint n, case MESA_FORMAT_Z32: unpack = unpack_float_z_Z32; break; + case MESA_FORMAT_Z32_FLOAT: + unpack = unpack_float_z_Z32F; + break; case MESA_FORMAT_Z32_FLOAT_X24S8: unpack = unpack_float_z_Z32X24S8; break; @@ -1959,7 +1968,8 @@ _mesa_unpack_uint_24_8_depth_stencil_row(gl_format format, GLuint n, unpack_uint_24_8_depth_stencil_S8_Z24(src, dst, n); break; default: - _mesa_problem(NULL, "bad format %s in _mesa_unpack_ubyte_s_row", + _mesa_problem(NULL, + "bad format %s in _mesa_unpack_uint_24_8_depth_stencil_row", _mesa_get_format_name(format)); return; } diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index c6febb0e5..b934bd4d8 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -414,7 +414,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = MESA_FORMAT_Z24_S8, /* Name */ "MESA_FORMAT_Z24_S8", /* StrName */ GL_DEPTH_STENCIL, /* BaseFormat */ - GL_UNSIGNED_INT, /* DataType */ + GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ @@ -423,7 +423,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = MESA_FORMAT_S8_Z24, /* Name */ "MESA_FORMAT_S8_Z24", /* StrName */ GL_DEPTH_STENCIL, /* BaseFormat */ - GL_UNSIGNED_INT, /* DataType */ + GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ @@ -432,7 +432,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = MESA_FORMAT_Z16, /* Name */ "MESA_FORMAT_Z16", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_UNSIGNED_INT, /* DataType */ + GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 16, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 2 /* BlockWidth/Height,Bytes */ @@ -441,7 +441,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = MESA_FORMAT_X8_Z24, /* Name */ "MESA_FORMAT_X8_Z24", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_UNSIGNED_INT, /* DataType */ + GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ @@ -450,7 +450,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = MESA_FORMAT_Z24_X8, /* Name */ "MESA_FORMAT_Z24_X8", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_UNSIGNED_INT, /* DataType */ + GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ @@ -459,7 +459,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = MESA_FORMAT_Z32, /* Name */ "MESA_FORMAT_Z32", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_UNSIGNED_INT, /* DataType */ + GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 32, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index b3427dac1..96a44266c 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2844,6 +2844,7 @@ struct gl_extensions GLboolean ARB_ES2_compatibility; GLboolean ARB_blend_func_extended; GLboolean ARB_color_buffer_float; + GLboolean ARB_conservative_depth; GLboolean ARB_copy_buffer; GLboolean ARB_depth_buffer_float; GLboolean ARB_depth_clamp; @@ -2942,7 +2943,6 @@ struct gl_extensions GLboolean EXT_vertex_array_bgra; GLboolean OES_standard_derivatives; /* vendor extensions */ - GLboolean AMD_conservative_depth; GLboolean AMD_seamless_cubemap_per_texture; GLboolean APPLE_packed_pixels; GLboolean APPLE_vertex_array_object; diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index 8048a7286..a7b7ed7f2 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -60,7 +60,7 @@ fast_read_depth_pixels( struct gl_context *ctx, if (packing->SwapBytes) return GL_FALSE; - if (_mesa_get_format_datatype(rb->Format) != GL_UNSIGNED_INT) + if (_mesa_get_format_datatype(rb->Format) != GL_UNSIGNED_NORMALIZED) return GL_FALSE; if (!((type == GL_UNSIGNED_SHORT && rb->Format == MESA_FORMAT_Z16) || @@ -381,7 +381,7 @@ fast_read_depth_stencil_pixels_separate(struct gl_context *ctx, GLubyte *depthMap, *stencilMap; int depthStride, stencilStride, i, j; - if (_mesa_get_format_datatype(depthRb->Format) != GL_UNSIGNED_INT) + if (_mesa_get_format_datatype(depthRb->Format) != GL_UNSIGNED_NORMALIZED) return GL_FALSE; ctx->Driver.MapRenderbuffer(ctx, depthRb, x, y, width, height, diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c index aebe38ee0..ee9552bc0 100644 --- a/mesalib/src/mesa/main/texformat.c +++ b/mesalib/src/mesa/main/texformat.c @@ -326,6 +326,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, case GL_ALPHA32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); break; case GL_LUMINANCE16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16); @@ -335,6 +337,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, case GL_LUMINANCE32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); break; case GL_LUMINANCE_ALPHA16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16); @@ -344,6 +348,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, case GL_LUMINANCE_ALPHA32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); break; case GL_INTENSITY16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16); @@ -353,15 +359,20 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, case GL_INTENSITY32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); break; case GL_RGB16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_RGB32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); break; case GL_RGBA16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); @@ -369,6 +380,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, break; case GL_RGBA32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); break; default: ; /* fallthrough */ diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index c8ea4329f..56335ad10 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -1021,15 +1021,8 @@ make_null_texture(GLint width, GLint height, GLint depth, GLenum format) /** - * Reset the fields of a gl_texture_image struct to zero. - * - * \param img texture image structure. - * - * This is called when a proxy texture test fails, we set all the - * image members (except DriverData) to zero. - * It's also used in glTexImage[123]D as a safeguard to be sure all - * required fields get initialized properly by the Driver.TexImage[123]D - * functions. + * Set the size and format-related fields of a gl_texture_image struct + * to zero. This is used when a proxy texture test fails. */ static void clear_teximage_fields(struct gl_texture_image *img) diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index 17eac5fc9..0081c3b52 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -884,6 +884,70 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params) } +static GLboolean +base_format_has_channel(GLenum base_format, GLenum pname) +{ + switch (pname) { + case GL_TEXTURE_RED_SIZE: + case GL_TEXTURE_RED_TYPE: + if (base_format == GL_RED || + base_format == GL_RG || + base_format == GL_RGB || + base_format == GL_RGBA) { + return GL_TRUE; + } + return GL_FALSE; + case GL_TEXTURE_GREEN_SIZE: + case GL_TEXTURE_GREEN_TYPE: + if (base_format == GL_RG || + base_format == GL_RGB || + base_format == GL_RGBA) { + return GL_TRUE; + } + return GL_FALSE; + case GL_TEXTURE_BLUE_SIZE: + case GL_TEXTURE_BLUE_TYPE: + if (base_format == GL_RGB || + base_format == GL_RGBA) { + return GL_TRUE; + } + return GL_FALSE; + case GL_TEXTURE_ALPHA_SIZE: + case GL_TEXTURE_ALPHA_TYPE: + if (base_format == GL_RGBA || + base_format == GL_ALPHA || + base_format == GL_LUMINANCE_ALPHA) { + return GL_TRUE; + } + return GL_FALSE; + case GL_TEXTURE_LUMINANCE_SIZE: + case GL_TEXTURE_LUMINANCE_TYPE: + if (base_format == GL_LUMINANCE || + base_format == GL_LUMINANCE_ALPHA) { + return GL_TRUE; + } + return GL_FALSE; + case GL_TEXTURE_INTENSITY_SIZE: + case GL_TEXTURE_INTENSITY_TYPE: + if (base_format == GL_INTENSITY) { + return GL_TRUE; + } + return GL_FALSE; + case GL_TEXTURE_DEPTH_SIZE: + case GL_TEXTURE_DEPTH_TYPE: + if (base_format == GL_DEPTH_STENCIL || + base_format == GL_DEPTH_COMPONENT) { + return GL_TRUE; + } + return GL_FALSE; + default: + _mesa_warning(NULL, "%s: Unexpected channel token 0x%x\n", + __FUNCTION__, pname); + return GL_FALSE; + } + + return GL_FALSE; +} void GLAPIENTRY @@ -981,27 +1045,10 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = img->Border; break; case GL_TEXTURE_RED_SIZE: - if (img->_BaseFormat == GL_RED) { - *params = _mesa_get_format_bits(texFormat, pname); - break; - } - /* FALLTHROUGH */ case GL_TEXTURE_GREEN_SIZE: - if (img->_BaseFormat == GL_RG) { - *params = _mesa_get_format_bits(texFormat, pname); - break; - } - /* FALLTHROUGH */ case GL_TEXTURE_BLUE_SIZE: - if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) - *params = _mesa_get_format_bits(texFormat, pname); - else - *params = 0; - break; case GL_TEXTURE_ALPHA_SIZE: - if (img->_BaseFormat == GL_ALPHA || - img->_BaseFormat == GL_LUMINANCE_ALPHA || - img->_BaseFormat == GL_RGBA) + if (base_format_has_channel(img->_BaseFormat, pname)) *params = _mesa_get_format_bits(texFormat, pname); else *params = 0; @@ -1067,46 +1114,18 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, /* GL_ARB_texture_float */ case GL_TEXTURE_RED_TYPE_ARB: - if (!ctx->Extensions.ARB_texture_float) - goto invalid_pname; - *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE) ? - _mesa_get_format_datatype(texFormat) : GL_NONE; - break; case GL_TEXTURE_GREEN_TYPE_ARB: - if (!ctx->Extensions.ARB_texture_float) - goto invalid_pname; - *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE) ? - _mesa_get_format_datatype(texFormat) : GL_NONE; - break; case GL_TEXTURE_BLUE_TYPE_ARB: - if (!ctx->Extensions.ARB_texture_float) - goto invalid_pname; - *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE) ? - _mesa_get_format_datatype(texFormat) : GL_NONE; - break; case GL_TEXTURE_ALPHA_TYPE_ARB: - if (!ctx->Extensions.ARB_texture_float) - goto invalid_pname; - *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE) ? - _mesa_get_format_datatype(texFormat) : GL_NONE; - break; case GL_TEXTURE_LUMINANCE_TYPE_ARB: - if (!ctx->Extensions.ARB_texture_float) - goto invalid_pname; - *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_LUMINANCE_SIZE) ? - _mesa_get_format_datatype(texFormat) : GL_NONE; - break; case GL_TEXTURE_INTENSITY_TYPE_ARB: - if (!ctx->Extensions.ARB_texture_float) - goto invalid_pname; - *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_INTENSITY_SIZE) ? - _mesa_get_format_datatype(texFormat) : GL_NONE; - break; case GL_TEXTURE_DEPTH_TYPE_ARB: if (!ctx->Extensions.ARB_texture_float) goto invalid_pname; - *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE) ? - _mesa_get_format_datatype(texFormat) : GL_NONE; + if (base_format_has_channel(img->_BaseFormat, pname)) + *params = _mesa_get_format_datatype(texFormat); + else + *params = GL_NONE; break; default: diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index 05c1964d6..aae6b4b3b 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -986,12 +986,17 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffffffff; const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); - const GLenum dstType = _mesa_get_format_datatype(dstFormat); + GLenum dstType; (void) dims; ASSERT(dstFormat == MESA_FORMAT_Z32 || dstFormat == MESA_FORMAT_Z32_FLOAT); ASSERT(texelBytes == sizeof(GLuint)); + if (dstFormat == MESA_FORMAT_Z32) + dstType = GL_UNSIGNED_INT; + else + dstType = GL_FLOAT; + if (ctx->Pixel.DepthScale == 1.0f && ctx->Pixel.DepthBias == 0.0f && !srcPacking->SwapBytes && -- cgit v1.2.3