From mboxrd@z Thu Jan 1 00:00:00 1970 From: michal Subject: Re: [Mesa3d-dev] [mesa] svga: Fix error: cannot take address of bit-field 'texture_target' in svga_tgsi.h Date: Wed, 06 Jan 2010 18:39:55 +0100 Message-ID: <4B44CAEB.60701@vmware.com> References: <2d0a357f1001060834k23c2ad38pa2111565f6defa42@mail.gmail.com> <4B44C358.2020005@vmware.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010808050908020607070102" Return-path: In-Reply-To: <4B44C358.2020005@vmware.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.sourceforge.net To: Brian Paul Cc: "sedat.dilek@gmail.com" , DRI , "mesa3d-dev@lists.sourceforge.net" List-Id: dri-devel@lists.freedesktop.org This is a multi-part message in MIME format. --------------010808050908020607070102 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Brian Paul wrote on 2010-01-06 18:07: > Sedat Dilek wrote: > >> Hi, >> >> this patch fixes a build-error in mesa GIT master after... >> >> commit 251363e8f1287b54dc7734e690daf2ae96728faf (patch) >> "configs: set INTEL_LIBS, INTEL_CFLAGS, etcmaster" >> >> >From my build-log: >> ... >> In file included from svga_pipe_fs.c:37: >> svga_tgsi.h: In function 'svga_fs_key_size': >> svga_tgsi.h:122: error: cannot take address of bit-field 'texture_target' >> make[4]: *** [svga_pipe_fs.o] Error 1 >> >> Might be introduced in... >> >> commit 955f51270bb60ad77dba049799587dc7c0fb4dda >> "Make sure we use only signed/unsigned ints with bitfields." >> >> Kind Regars, >> - Sedat - >> >> > > I just fixed that. > > Actually, we could go back to bitfields and fix broken svga_fs_key_size(). Attached a patch. Can somebody review, test-build and commit? --------------010808050908020607070102 Content-Type: text/plain; name="0001-svga-Fix-fs-key-size-computation-and-key-comparison.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0001-svga-Fix-fs-key-size-computation-and-key-comparison.pat"; filename*1="ch" >>From 7321aef0dfc5bb160ec8a33d1d4e686419f2ed3d Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 6 Jan 2010 18:36:45 +0100 Subject: [PATCH] svga: Fix fs key size computation and key comparison. This also allows us to have texture_target back as a bitfield and save us a few bytes. --- src/gallium/drivers/svga/svga_state_fs.c | 9 +++++++-- src/gallium/drivers/svga/svga_tgsi.h | 5 ++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c index 272d1dd..bba80a9 100644 --- a/src/gallium/drivers/svga/svga_state_fs.c +++ b/src/gallium/drivers/svga/svga_state_fs.c @@ -40,8 +40,13 @@ static INLINE int compare_fs_keys( const struct svga_fs_compile_key *a, const struct svga_fs_compile_key *b ) { - unsigned keysize = svga_fs_key_size( a ); - return memcmp( a, b, keysize ); + unsigned keysize_a = svga_fs_key_size( a ); + unsigned keysize_b = svga_fs_key_size( b ); + + if (keysize_a != keysize_b) { + return (int)(keysize_a - keysize_b); + } + return memcmp( a, b, keysize_a ); } diff --git a/src/gallium/drivers/svga/svga_tgsi.h b/src/gallium/drivers/svga/svga_tgsi.h index 043b991..737a221 100644 --- a/src/gallium/drivers/svga/svga_tgsi.h +++ b/src/gallium/drivers/svga/svga_tgsi.h @@ -56,7 +56,7 @@ struct svga_fs_compile_key unsigned compare_func:3; unsigned unnormalized:1; unsigned width_height_idx:7; - ubyte texture_target; + unsigned texture_target:8; } tex[PIPE_MAX_SAMPLERS]; }; @@ -119,8 +119,7 @@ static INLINE unsigned svga_vs_key_size( const struct svga_vs_compile_key *key ) static INLINE unsigned svga_fs_key_size( const struct svga_fs_compile_key *key ) { - return (const char *)&key->tex[key->num_textures].texture_target - - (const char *)key; + return (const char *)&key->tex[key->num_textures] - (const char *)key; } struct svga_shader_result * -- 1.6.4.msysgit.0 --------------010808050908020607070102 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev --------------010808050908020607070102 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel --------------010808050908020607070102--