Re: [Mesa3d-dev] [PATCH] Fix compressed texture loads for non-minimal pitches again
Luca Barbieri wrote: Signed-off-by: Brian Paul bri...@vmware.com Please push this as well. Done. -Brian -- Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] [PATCH] Fix compressed texture loads for non-minimal pitches again
Signed-off-by: Brian Paul bri...@vmware.com Please push this as well. Thanks. -- Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] [PATCH] Fix compressed texture loads for non-minimal pitches again
Luca Barbieri wrote: My commit eea6a7639f767b1d30b6ef1f91a9c49e3f3b78f0 does a memcpy of height lines, but that's wrong because the texture has a block layout and we must thus use the number of vertical blocks instead of the height. --- src/mesa/state_tracker/st_cb_texture.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index d57304e..d5d3711 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -687,9 +687,11 @@ st_TexImage(GLcontext * ctx, { char *dst = texImage-Data; const char *src = pixels; - int i; + GLuint i, bw, bh, lines; + _mesa_get_format_block_size(texImage-TexFormat, bw, bh); + lines = (height + bh - 1) / bh; - for(i = 0; i height; ++i) + for(i = 0; i lines; ++i) { memcpy(dst, src, srcImageStride); dst += dstRowStride; Signed-off-by: Brian Paul bri...@vmware.com -- Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
[Mesa3d-dev] [PATCH] Fix compressed texture loads for non-minimal pitches again
My commit eea6a7639f767b1d30b6ef1f91a9c49e3f3b78f0 does a memcpy of height lines, but that's wrong because the texture has a block layout and we must thus use the number of vertical blocks instead of the height. --- src/mesa/state_tracker/st_cb_texture.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index d57304e..d5d3711 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -687,9 +687,11 @@ st_TexImage(GLcontext * ctx, { char *dst = texImage-Data; const char *src = pixels; - int i; + GLuint i, bw, bh, lines; + _mesa_get_format_block_size(texImage-TexFormat, bw, bh); + lines = (height + bh - 1) / bh; - for(i = 0; i height; ++i) + for(i = 0; i lines; ++i) { memcpy(dst, src, srcImageStride); dst += dstRowStride; -- 1.6.3.3 -- Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] [PATCH] Fix compressed texture loads for non-minimal pitches
On Sun, 2010-01-10 at 12:04 -0800, Luca Barbieri wrote: + { + char* dst = texImage-Data; + char* src = pixels; + for(int i = 0; i height; ++i) + { +memcpy(dst, src, srcImageStride); +dst += dstRowStride; +src += srcImageStride; How are you building Mesa, Luca? This throws up a warning and an error with the basic make linux-debug method: gcc -c -I../../include -I../../src/mesa -I../../src/gallium/include -I../../src/gallium/auxiliary -Wall -Wmissing-prototypes -Wdeclaration-after-statement -Wpointer-arith -g -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DPTHREADS -DUSE_XSHM -DHAVE_POSIX_MEMALIGN -DDEBUG -DDEBUG_MATH -I/usr/X11R6/include -std=c99 -ffast-math -fno-strict-aliasing -ansi -pedantic state_tracker/st_cb_texture.c -o state_tracker/st_cb_texture.o state_tracker/st_cb_texture.c: In function 'st_TexImage': state_tracker/st_cb_texture.c:689: warning: initialization discards qualifiers from pointer target type state_tracker/st_cb_texture.c:690: error: 'for' loop initial declarations are only allowed in C99 mode I'll adjust the code and commit. Keith -- 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 ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] [PATCH] Fix compressed texture loads for non-minimal pitches
gcc -c -I../../include -I../../src/mesa -I../../src/gallium/include -I../../src/gallium/auxiliary -Wall -Wmissing-prototypes -Wdeclaration-after-statement -Wpointer-arith -g -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DPTHREADS -DUSE_XSHM -DHAVE_POSIX_MEMALIGN -DDEBUG -DDEBUG_MATH -I/usr/X11R6/include -std=c99 -ffast-math -fno-strict-aliasing -ansi -pedantic state_tracker/st_cb_texture.c -o state_tracker/st_cb_texture.o state_tracker/st_cb_texture.c: In function 'st_TexImage': state_tracker/st_cb_texture.c:689: warning: initialization discards qualifiers from pointer target type state_tracker/st_cb_texture.c:690: error: 'for' loop initial declarations are only allowed in C99 mode On my setup (./configure make) Mesa is getting built in C99 mode, which compiles that code. The command line you quoted actually contains -std=c99, but also contains -ansi later, which is causing the problem. It seems that the linux-debug target includes -ansi (thus disabling C99) but the default autoconf one doesn't, resulting in C99 mode! Some parts of the codebase (such as all radeon drivers) contain for loop declarations and thus require C99 mode. I think -ansi should be removed from all files in configs/*. -- 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 ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
[Mesa3d-dev] [PATCH] Fix compressed texture loads for non-minimal pitches
The current glCompressedTexImage support in the state tracker assumes that compressed textures have minimal pitch. However, in some cases this is not true, such as for mipmaps of non-POT compressed textures on nVidia hardware. This patch adds a check and does a memcpy for each line instead of the whole image in that case. --- src/mesa/state_tracker/st_cb_texture.c | 15 ++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 84e946e..d1416f0 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -683,7 +683,20 @@ st_TexImage(GLcontext * ctx, * conversion and copy: */ if (compressed_src) { - memcpy(texImage-Data, pixels, imageSize); + const GLuint srcImageStride = _mesa_format_row_stride(texImage-TexFormat, width); + if(dstRowStride == srcImageStride) + memcpy(texImage-Data, pixels, imageSize); + else + { + char* dst = texImage-Data; + char* src = pixels; + for(int i = 0; i height; ++i) + { +memcpy(dst, src, srcImageStride); +dst += dstRowStride; +src += srcImageStride; + } + } } else { const GLuint srcImageStride = -- 1.6.3.3 -- 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 ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev