From 022d9c6cf6a67385d84ff33ce095f5c7f9f6d0cc Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 28 Jul 2010 18:15:53 +0000 Subject: Update to mesa 7,8,2 --- mesalib/src/mesa/main/fbobject.c | 6 ++--- mesalib/src/mesa/main/imports.c | 3 ++- mesalib/src/mesa/main/imports.h | 6 +++-- mesalib/src/mesa/main/texenvprogram.c | 43 +++++++++++++++++++++++------------ mesalib/src/mesa/main/texfetch_tmp.h | 16 ++++++------- mesalib/src/mesa/main/version.h | 4 ++-- 6 files changed, 47 insertions(+), 31 deletions(-) (limited to 'mesalib/src/mesa/main') diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 14c533e0d..cc20f7479 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -1766,10 +1766,10 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, rb = NULL; } - if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { + if (attachment == GL_DEPTH_STENCIL_ATTACHMENT && + rb && rb->Format != MESA_FORMAT_NONE) { /* make sure the renderbuffer is a depth/stencil format */ - const GLenum baseFormat = - _mesa_get_format_base_format(att->Renderbuffer->Format); + const GLenum baseFormat = _mesa_get_format_base_format(rb->Format); if (baseFormat != GL_DEPTH_STENCIL) { _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferRenderbufferEXT(renderbuffer" diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c index 1ae085336..b1389b25f 100644 --- a/mesalib/src/mesa/main/imports.c +++ b/mesalib/src/mesa/main/imports.c @@ -564,7 +564,8 @@ _mesa_ffsll(int64_t val) unsigned int _mesa_bitcount(unsigned int n) { -#if defined(__GNUC__) +#if defined(__GNUC__) && \ + ((_GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4) return __builtin_popcount(n); #else unsigned int bits; diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index d28f4ad12..1c263aabc 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -404,7 +404,8 @@ _mesa_is_pow_two(int x) static INLINE int32_t _mesa_next_pow_two_32(uint32_t x) { -#ifdef __GNUC__ +#if defined(__GNUC__) && \ + ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4) uint32_t y = (x != 1); return (1 + y) << ((__builtin_clz(x - y) ^ 31) ); #else @@ -422,7 +423,8 @@ _mesa_next_pow_two_32(uint32_t x) static INLINE int64_t _mesa_next_pow_two_64(uint64_t x) { -#ifdef __GNUC__ +#if defined(__GNUC__) && \ + ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4) uint64_t y = (x != 1); if (sizeof(x) == sizeof(long)) return (1 + y) << ((__builtin_clzl(x - y) ^ 63)); diff --git a/mesalib/src/mesa/main/texenvprogram.c b/mesalib/src/mesa/main/texenvprogram.c index 7b8a8b85f..964ba13c7 100644 --- a/mesalib/src/mesa/main/texenvprogram.c +++ b/mesalib/src/mesa/main/texenvprogram.c @@ -1415,6 +1415,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, struct texenv_fragment_program p; GLuint unit; struct ureg cf, out; + int i; memset(&p, 0, sizeof(p)); p.state = key; @@ -1436,7 +1437,13 @@ create_new_program(GLcontext *ctx, struct state_key *key, p.program->Base.NumAddressRegs = 0; p.program->Base.Parameters = _mesa_new_parameter_list(); p.program->Base.InputsRead = 0x0; - p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR; + + if (ctx->DrawBuffer->_NumColorDrawBuffers == 1) + p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR; + else { + for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) + p.program->Base.OutputsWritten |= (1 << (FRAG_RESULT_DATA0 + i)); + } for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { p.src_texture[unit] = undef; @@ -1485,22 +1492,28 @@ create_new_program(GLcontext *ctx, struct state_key *key, } cf = get_source( &p, SRC_PREVIOUS, 0 ); - out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR ); - if (key->separate_specular) { - /* Emit specular add. - */ - struct ureg s = register_input(&p, FRAG_ATTRIB_COL1); - emit_arith( &p, OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef ); - emit_arith( &p, OPCODE_MOV, out, WRITEMASK_W, 0, cf, undef, undef ); - } - else if (memcmp(&cf, &out, sizeof(cf)) != 0) { - /* Will wind up in here if no texture enabled or a couple of - * other scenarios (GL_REPLACE for instance). - */ - emit_arith( &p, OPCODE_MOV, out, WRITEMASK_XYZW, 0, cf, undef, undef ); - } + for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { + if (ctx->DrawBuffer->_NumColorDrawBuffers == 1) + out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR ); + else { + out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i ); + } + if (key->separate_specular) { + /* Emit specular add. + */ + struct ureg s = register_input(&p, FRAG_ATTRIB_COL1); + emit_arith( &p, OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef ); + emit_arith( &p, OPCODE_MOV, out, WRITEMASK_W, 0, cf, undef, undef ); + } + else if (memcmp(&cf, &out, sizeof(cf)) != 0) { + /* Will wind up in here if no texture enabled or a couple of + * other scenarios (GL_REPLACE for instance). + */ + emit_arith( &p, OPCODE_MOV, out, WRITEMASK_XYZW, 0, cf, undef, undef ); + } + } /* Finish up: */ emit_arith( &p, OPCODE_END, undef, WRITEMASK_XYZW, 0, undef, undef, undef); diff --git a/mesalib/src/mesa/main/texfetch_tmp.h b/mesalib/src/mesa/main/texfetch_tmp.h index e6772c89f..b11ed5c39 100644 --- a/mesalib/src/mesa/main/texfetch_tmp.h +++ b/mesalib/src/mesa/main/texfetch_tmp.h @@ -1215,10 +1215,10 @@ static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s >> 24) ); - texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff ); - texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >> 8) & 0xff ); - texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s ) & 0xff ); + texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) ); + texel[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 16) ); + texel[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) ); + texel[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s ) ); } #if DIM == 3 @@ -1235,10 +1235,10 @@ static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s ) & 0xff ); - texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >> 8) & 0xff ); - texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff ); - texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s >> 24) ); + texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s ) ); + texel[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) ); + texel[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 16) ); + texel[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) ); } #if DIM == 3 diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h index cd760beba..9955be24a 100644 --- a/mesalib/src/mesa/main/version.h +++ b/mesalib/src/mesa/main/version.h @@ -34,8 +34,8 @@ /* Mesa version */ #define MESA_MAJOR 7 #define MESA_MINOR 8 -#define MESA_PATCH 1 -#define MESA_VERSION_STRING "7.8.1" +#define MESA_PATCH 2 +#define MESA_VERSION_STRING "7.8.2" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3