Re: [Piglit] [PATCH] textureSize: Initialize sample_count to 1.

2013-10-07 Thread Paul Berry
On 23 September 2013 20:46, Kenneth Graunke  wrote:

> The multisampling tests initialize the number of miplevels to the number
> of samples.  Since this is zero, we allocate an array of zero miplevels,
> and then try to write to the first element.
>
> Fixes the following Valgrind error:
>
> Invalid write of size 8
>at 0x403123: compute_miplevel_info (common.c:163)
>by 0x402B9B: piglit_init (textureSize.c:455)
>by 0x4EA6B89: run_test (piglit_fbo_framework.c:50)
>by 0x4EA4BEE: piglit_gl_test_run (piglit-framework-gl.c:141)
>by 0x401FC7: main (textureSize.c:68)
>  Address 0xa04d040 is 0 bytes after a block of size 0 alloc'd
>at 0x4C2757B: malloc (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
>by 0x40310A: compute_miplevel_info (common.c:161)
>by 0x402B9B: piglit_init (textureSize.c:455)
>by 0x4EA6B89: run_test (piglit_fbo_framework.c:50)
>by 0x4EA4BEE: piglit_gl_test_run (piglit-framework-gl.c:141)
>by 0x401FC7: main (textureSize.c:68)
>
> Signed-off-by: Kenneth Graunke 
> Cc: Chris Forbes 
> ---
>  tests/texturing/shaders/textureSize.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tests/texturing/shaders/textureSize.c
> b/tests/texturing/shaders/textureSize.c
> index f010d9c..85a11d3 100644
> --- a/tests/texturing/shaders/textureSize.c
> +++ b/tests/texturing/shaders/textureSize.c
> @@ -432,6 +432,8 @@ piglit_init(int argc, char **argv)
> int prog;
> int tex_location;
>
> +   sample_count = 1;
> +
> require_GL_features(test_stage);
>
> if (sampler.target == GL_TEXTURE_CUBE_MAP_ARRAY)
>

It looks like the textureSize test creates its textures using common.c's
upload_miplevel_data(), which always passes a sample count of 4 to
glTexImage{2,3}DMultisample().  Would it be better to set sample_count to 4
to match this?

In addition, maybe we should change upload_miplevel_data() so that it
passes sample_count to glTexImage{2,3}DMultisample() rather than hardcoding
a sample count of 4.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] textureSize: Initialize sample_count to 1.

2013-09-23 Thread Kenneth Graunke
The multisampling tests initialize the number of miplevels to the number
of samples.  Since this is zero, we allocate an array of zero miplevels,
and then try to write to the first element.

Fixes the following Valgrind error:

Invalid write of size 8
   at 0x403123: compute_miplevel_info (common.c:163)
   by 0x402B9B: piglit_init (textureSize.c:455)
   by 0x4EA6B89: run_test (piglit_fbo_framework.c:50)
   by 0x4EA4BEE: piglit_gl_test_run (piglit-framework-gl.c:141)
   by 0x401FC7: main (textureSize.c:68)
 Address 0xa04d040 is 0 bytes after a block of size 0 alloc'd
   at 0x4C2757B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x40310A: compute_miplevel_info (common.c:161)
   by 0x402B9B: piglit_init (textureSize.c:455)
   by 0x4EA6B89: run_test (piglit_fbo_framework.c:50)
   by 0x4EA4BEE: piglit_gl_test_run (piglit-framework-gl.c:141)
   by 0x401FC7: main (textureSize.c:68)

Signed-off-by: Kenneth Graunke 
Cc: Chris Forbes 
---
 tests/texturing/shaders/textureSize.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/texturing/shaders/textureSize.c 
b/tests/texturing/shaders/textureSize.c
index f010d9c..85a11d3 100644
--- a/tests/texturing/shaders/textureSize.c
+++ b/tests/texturing/shaders/textureSize.c
@@ -432,6 +432,8 @@ piglit_init(int argc, char **argv)
int prog;
int tex_location;
 
+   sample_count = 1;
+
require_GL_features(test_stage);
 
if (sampler.target == GL_TEXTURE_CUBE_MAP_ARRAY)
-- 
1.8.3.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit