Bug 76496

Summary: [IVB/HSW] ogl-samples: gl-330-texture-rect assertion fails
Product: Mesa Reporter: Kenneth Graunke <kenneth>
Component: Drivers/DRI/i965Assignee: Ian Romanick <idr>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: anuj.phogat, eero.t.tamminen, itoral, jianx.zhou, kenneth, mengmeng.meng
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Kenneth Graunke 2014-03-23 08:08:14 UTC
+++ This bug was initially created as a clone of Bug #76399 +++

System Environment:
--------------------------
Mesa:   (master)eaf9affa5ec9c5fd919e4207ab80b4677650ac67
Xserver:(master)xorg-server-1.15.99.901 Xf86_video_intel:	
Xf86_video_intel:(master)2.99.911
Kernel:	(drm-intel-nightly) git-ec45c7

Bug detailed description:
----------------------------
It’s not a regression, firstly test ogl-samples.

Pre-conditions:
 - build: https://github.com/g-truc/ogl-samples

Test-case: gl-330-texture-rect

Expected outcome:
-----------------
https://github.com/g-truc/ogl-samples/blob/master/data/templates/reference/gl-330-texture-rectangle.png

Actual outcome:
------------------------
It’s core dump.
   -"OpenGL Error(GL_INVALID_OPERATION): initTexture"
   -ogl-samples/framework/test.cpp:412: bool test::checkError(const char*) const: Assertion `0' failed.
Comment 1 Kenneth Graunke 2014-03-23 08:10:57 UTC
Apparently, the test calls glTexParameteri with a pname of GL_TEXTURE_MAX_LEVEL and param value of 0.

I don't see any text offhand which state you /can't/ do that, but given that rectangle textures don't support mipmapping, it seems weird...
Comment 2 Iago Toral 2014-03-31 08:08:39 UTC
(In reply to comment #1)
> Apparently, the test calls glTexParameteri with a pname of
> GL_TEXTURE_MAX_LEVEL and param value of 0.
> 
> I don't see any text offhand which state you /can't/ do that, but given that
> rectangle textures don't support mipmapping, it seems weird...

From http://www.opengl.org/wiki/Rectangle_Texture:

"Rectangle textures contain exactly one image; they cannot have mipmaps. Therefore, any texture parameters that depend on LODs are irrelevant when used with rectangle textures; attempting to set these parameters to any value other than 0 will result in an error."

Based on this I understand that that setting a value of 0 for GL_TEXTURE_MAX_LEVEL should not produce an error in this case.

I sent a patch to the mailing list:
http://lists.freedesktop.org/archives/mesa-dev/2014-March/056844.html
Comment 3 meng 2014-04-01 07:35:46 UTC
(In reply to comment #2)
With above patch, the problem is fixed.
Comment 4 Emil Velikov 2014-04-09 14:19:06 UTC
commit f5904b732efd6ad1ec8273ce3c72dbf38df7076c
Author: Iago Toral Quiroga <itoral@igalia.com>
Date:   Mon Mar 31 02:04:00 2014 -0600

    mesa: Allow setting GL_TEXTURE_MAX_LEVEL to 0 with GL_TEXTURE_RECTANGLE.

    Currently, we raise an error when doing this which breaks a conformance
    test from the OpenGL samples pack. Even if this is a bit silly it is not
    an error.

    From http://www.opengl.org/wiki/Rectangle_Texture:

    "Rectangle textures contain exactly one image; they cannot have mipmaps.
    Therefore, any texture parameters that depend on LODs are irrelevant
    when used with rectangle textures; attempting to set these parameters to
    any value other than 0 will result in an error."

    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76496

    Reviewed-by: Brian Paul <brianp@vmware.com>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.