<div dir="ltr">On 23 September 2013 20:46, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The multisampling tests initialize the number of miplevels to the number<br>
of samples.  Since this is zero, we allocate an array of zero miplevels,<br>
and then try to write to the first element.<br>
<br>
Fixes the following Valgrind error:<br>
<br>
Invalid write of size 8<br>
   at 0x403123: compute_miplevel_info (common.c:163)<br>
   by 0x402B9B: piglit_init (textureSize.c:455)<br>
   by 0x4EA6B89: run_test (piglit_fbo_framework.c:50)<br>
   by 0x4EA4BEE: piglit_gl_test_run (piglit-framework-gl.c:141)<br>
   by 0x401FC7: main (textureSize.c:68)<br>
 Address 0xa04d040 is 0 bytes after a block of size 0 alloc'd<br>
   at 0x4C2757B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br>
   by 0x40310A: compute_miplevel_info (common.c:161)<br>
   by 0x402B9B: piglit_init (textureSize.c:455)<br>
   by 0x4EA6B89: run_test (piglit_fbo_framework.c:50)<br>
   by 0x4EA4BEE: piglit_gl_test_run (piglit-framework-gl.c:141)<br>
   by 0x401FC7: main (textureSize.c:68)<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
Cc: Chris Forbes <<a href="mailto:chrisf@ijw.co.nz">chrisf@ijw.co.nz</a>><br>
---<br>
 tests/texturing/shaders/textureSize.c | 2 ++<br>
 1 file changed, 2 insertions(+)<br>
<br>
diff --git a/tests/texturing/shaders/textureSize.c b/tests/texturing/shaders/textureSize.c<br>
index f010d9c..85a11d3 100644<br>
--- a/tests/texturing/shaders/textureSize.c<br>
+++ b/tests/texturing/shaders/textureSize.c<br>
@@ -432,6 +432,8 @@ piglit_init(int argc, char **argv)<br>
        int prog;<br>
        int tex_location;<br>
<br>
+       sample_count = 1;<br>
+<br>
        require_GL_features(test_stage);<br>
<br>
        if (sampler.target == GL_TEXTURE_CUBE_MAP_ARRAY)<br></blockquote><div><br></div><div>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?<br>
<br></div><div>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.<br></div></div></div></div>