On Mon, Feb 27, 2012 at 10:54 AM, Anuj Phogat <span dir="ltr">&lt;<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">On Mon, Feb 27, 2012 at 7:44 AM, Brian Paul <span dir="ltr">&lt;<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>&gt;</span> wrote:<br></div></div><div class="gmail_quote">

<div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On 02/23/2012 08:27 PM, Anuj Phogat wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Intel driver throws GL_OUT_OF_MEMORY and assertion failure / segmentation<br>
fault with large textures.<br>
<br>
Reproduces the errors reported in:<br>
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=44970" target="_blank">https://bugs.freedesktop.org/<u></u>show_bug.cgi?id=44970</a><br>
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=46303" target="_blank">https://bugs.freedesktop.org/<u></u>show_bug.cgi?id=46303</a><br>
<br>
Signed-off-by: Anuj Phogat&lt;<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>&gt;<br>
---<br>
V3: Added the test using proxy textures, deleted redundant code,<br>
     data array allocation based on size returned<br>
<br>
ToDo: getMaxTarget, getProxyTarget and isValidTexSize functions can be added<br>
       as piglit utility functions in piglit-util-gl.c<br>
       I will do it in a separate patch.<br>
<br>
  tests/all.tests              |    1 +<br>
  tests/bugs/CMakeLists.gl.txt |    1 +<br>
  tests/bugs/large-textures.c  |  352 ++++++++++++++++++++++++++++++<u></u>++++++++++++<br>
  3 files changed, 354 insertions(+), 0 deletions(-)<br>
  create mode 100644 tests/bugs/large-textures.c<br>
</blockquote>
<br>
<br>
</div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff --git a/tests/bugs/large-textures.c b/tests/bugs/large-textures.c<br>
new file mode 100644<br>
index 0000000..c43f51e<br>
--- /dev/null<br>
+++ b/tests/bugs/large-textures.c<br>
@@ -0,0 +1,352 @@<br>
</blockquote>
<br></div>
The test should be moved to test/texturing/.  I think we agreed to move away from the tests/bugs/ directory.<br>
<br>
<br>
<br>
[...]<div><div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+void piglit_init(int argc, char **argv)<br>
+{<br>
+       GLuint tex;<br>
+       int i, j;<br>
+<br>
+       glMatrixMode(GL_PROJECTION);<br>
+       glPushMatrix();<br>
+       glLoadIdentity();<br>
+       glOrtho(0, piglit_width, 0, piglit_height, -1, 1);<br>
+       glMatrixMode(GL_MODELVIEW);<br>
+       glPushMatrix();<br>
+       glLoadIdentity();<br>
+       glClearColor(0.2, 0.2, 0.2, 1.0);<br>
+       glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+       for ( i = 0; i&lt;  ARRAY_SIZE(target); i++) {<br>
+<br>
+               glGenTextures(1,&amp;tex);<br>
+               glBindTexture(target[i], tex);<br>
+               glTexParameteri(target[i], GL_TEXTURE_MIN_FILTER, GL_NEAREST);<br>
+               glTexParameteri(target[i], GL_TEXTURE_MAG_FILTER, GL_NEAREST);<br>
+<br>
+               for (j = 0; j&lt;  ARRAY_SIZE(internalformat); j++) {<br>
+<br>
+                       if (internalformat[j] == GL_RGBA16F ||<br>
+                           internalformat[j] == GL_RGBA32F)<br>
+                               piglit_require_extension(&quot;GL_<u></u>ARB_texture_float&quot;);<br>
</blockquote>
<br></div></div>
I think you should simply skip the float formats if GL_ARB_texture_float is not supported (don&#39;t exit with SKIP result).<br></blockquote></div></div><div>Yes. That&#39;s the right thing i should do.</div><div><div class="h5">

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
I ran the test with NVIDIA&#39;s driver.  Here&#39;s what it printed:<br>
<br>
GL_PROXY_TEXTURE_1D, Internal Format = GL_RGBA8, Largest Texture Size = 16384<br>
GL_PROXY_TEXTURE_1D, Internal Format = GL_RGBA16, Largest Texture Size = 16384<br>
GL_PROXY_TEXTURE_1D, Internal Format = GL_RGBA32F, Largest Texture Size = 16384<br>
GL_PROXY_TEXTURE_2D, Internal Format = GL_RGBA8, Largest Texture Size = 16384<br>
GL_PROXY_TEXTURE_2D, Internal Format = GL_RGBA16, Largest Texture Size = 16384<br>
GL_PROXY_TEXTURE_2D, Internal Format = GL_RGBA32F, Largest Texture Size = 16384<br>
GL_PROXY_TEXTURE_CUBE_MAP, Internal Format = GL_RGBA8, Largest Texture Size = 16384<br>
GL_PROXY_TEXTURE_CUBE_MAP, Internal Format = GL_RGBA16, Largest Texture Size = 16384<br>
GL_PROXY_TEXTURE_CUBE_MAP, Internal Format = GL_RGBA32F, Largest Texture Size = 16384<br>
GL_PROXY_TEXTURE_3D, Internal Format = GL_RGBA8, Largest Texture Size = 2048<br>
GL_PROXY_TEXTURE_3D, Internal Format = GL_RGBA16, Largest Texture Size = 2048<br>
GL_PROXY_TEXTURE_3D, Internal Format = GL_RGBA32F, Largest Texture Size = 2048<br>
<br>
GL_TEXTURE_1D, Internal Format = GL_RGBA8, Largest Texture Size = 16384<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
GL_TEXTURE_1D, Internal Format = GL_RGBA16, Largest Texture Size = 16384<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
GL_TEXTURE_1D, Internal Format = GL_RGBA32F, Largest Texture Size = 16384<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
GL_TEXTURE_2D, Internal Format = GL_RGBA8, Largest Texture Size = 16384<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
GL_TEXTURE_2D, Internal Format = GL_RGBA16, Largest Texture Size = 16384<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
GL_TEXTURE_2D, Internal Format = GL_RGBA32F, Largest Texture Size = 16384<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
Unexpected GL error: GL_INVALID_VALUE 0x501<br>
GL_TEXTURE_CUBE_MAP, Internal Format = GL_RGBA16, Largest Texture Size = 16384<br>
[I killed it here after 10+ minutes of runtime]<br>


<br>
I don&#39;t know what&#39;s causing the INVALID_VALUE error.  </blockquote></div></div><div>GL_INVALID_VALUE error is thrown by the driver when we test with textures larger than maximum supported size. So, this is an expected error.</div>


<div>Another expected error is GL_OUT_OF_MEMORY when driver is unable to map a previously created large texture in glSubTexImage1D/2D/3D.</div><div>I will include both these errors as expected errors and put a comment about it.</div>

<div class="im">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The test runs _extremely_ slowly.  It looks like the driver is allocating some really large image buffers so we&#39;re falling back to virtual memory.  I don&#39;t know a way around this.  On one hand, it&#39;s good to test this, but nobody wants to wait 10+ minutes for the outcome.</blockquote>


</div><div>The purpose of this test case is to make sure that driver doesn&#39;t segfault  with large textures and throws relevant errors in case it is unable to allocate memory or map large textures. I am able to identify few issues in intel driver using this test case. If nVidia driver takes a long time to run the test, there&#39;s a possibility that they are not handling such cases properly. May be they should return GL_OUT_OF_MEMORY in that case.</div>


<div>or we can comment out GL_RGBA16 and GL_RGBA32F and put a comment informing users about the time test takes with those formats.</div></div><br>
</blockquote></div>I noticed below listed comment in tests/texturing/tex3d-maxsize.c which might explain the issue you are seeing on nvidia driver:<div>[...]</div><div><div>                /* use proxy texture to find working max texture size */</div>

<div>                find_max_tex3d_size(maxsize, &amp;width, &amp;height, &amp;depth);</div><div>#ifdef NVIDIA_HACK</div><div>                /* XXX NVIDIA&#39;s proxy texture mechanism is broken.</div><div>                 * If this code is enabled, a smaller texture is used and</div>

<div>                 * the test passes.  Only halving the texture size isn&#39;t enough:</div><div>                 * we try to allocate a gigantic texture which typically brings</div><div>                 * the machine to its knees, swapping, then dying.</div>

<div>                 */</div><div>                width /= 4;</div><div>                height /= 4;</div><div>                depth /= 4;</div><div>#endif</div><div>[...]</div><div><br></div></div>