Bug 98248

Summary: dEQP-GLES3.functional.state_query.integers.viewport_get* failure
Product: Mesa Reporter: Randy <randy.xu>
Component: Drivers/DRI/i965Assignee: Anuj Phogat <anuj.phogat>
Status: RESOLVED NOTOURBUG QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 94448    

Description Randy 2016-10-14 08:07:46 UTC
Three GLES3 cases failed on SKL GT2, but can pass on HSW


dEQP-GLES3.functional.state_query.integers.viewport_getfloat.qpa: <Result StatusCode="Fail">Got invalid float value</Result>
dEQP-GLES3.functional.state_query.integers.viewport_getinteger64.qpa: <Result StatusCode="Fail">Got invalid integer value</Result>
dEQP-GLES3.functional.state_query.integers.viewport_getinteger.qpa: <Result StatusCode="Fail">Got invalid integer value</Result>


Mesa git top commit: 389d6dedbe75defe07216ad761569a9b94f44e58
dEQP git top commit: ca988480be945772473f9256b6ae91fa6aa62bd1
Comment 1 Randy 2016-10-14 08:09:12 UTC
Per the error log, the glGetFloatv return value are bound to [-32768, 32768]

 <Text>glGetFloatv(GL_VIEWPORT, 0x00007fffc202fca0);</Text>
 <Text>// data = { -1729, 32768, 7307, 4013 }</Text>
 <Text>// ERROR: expected -1729, 33539, 7307, 4013</Text>
 <Text>glGetError();</Text>
 <Text>// GL_NO_ERROR returned</Text>
 <Text>glViewport(41066, -9108, 11099, 30024);</Text>
 <Text>glGetFloatv(GL_VIEWPORT, 0x00007fffc202fca0);</Text>
 <Text>// data = { 32768, -9108, 11099, 30024 }</Text>
 <Text>// ERROR: expected 41066, -9108, 11099, 30024</Text>
 <Text>glGetError();</Text>
Comment 2 Kenneth Graunke 2016-10-14 18:42:49 UTC
Anuj believes this is a bug in the tests, and submitted a patch to fix that:
https://gitlab.khronos.org/opengl/cts/merge_requests/399

Not sure what the status is.
Comment 3 Randy 2016-10-15 03:05:11 UTC
(In reply to Kenneth Graunke from comment #2)
> Anuj believes this is a bug in the tests, and submitted a patch to fix that:
> https://gitlab.khronos.org/opengl/cts/merge_requests/399
> 
> Not sure what the status is.

Thanks, Graunke. It's very helpful. I am curious why the viewport coordinates were not clamped on HSW, I use the same test app and driver binary.
Comment 4 Randy 2016-10-15 03:40:03 UTC
I got the answer in code, the OES_viewport_array is only enabled when gen >= 8

set_viewport_no_notify

   /* The GL_ARB_viewport_array spec says:
    *
    *     "The location of the viewport's bottom-left corner, given by (x,y),
    *     are clamped to be within the implementation-dependent viewport
    *     bounds range.  The viewport bounds range [min, max] tuple may be
    *     determined by calling GetFloatv with the symbolic constant
    *     VIEWPORT_BOUNDS_RANGE (see section 6.1)."
    */
   if (ctx->Extensions.ARB_viewport_array ||
       (ctx->Extensions.OES_viewport_array &&
        _mesa_is_gles31(ctx))) {
      x = CLAMP(x,
                ctx->Const.ViewportBounds.Min, ctx->Const.ViewportBounds.Max);
      y = CLAMP(y,
                ctx->Const.ViewportBounds.Min, ctx->Const.ViewportBounds.Max);
   }
Comment 5 Kenneth Graunke 2017-01-04 22:31:43 UTC
Both Pyry and Daniel have reviewed my respin of Anuj's change, so I expect it'll be landing in the CTS soon.  Then I'll need to patch dEQP.

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.