xuxiandi / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

glViewport is clamped to drawable size in ANGLE #224

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Dean McNamee has pointed out that the arguments to glViewport are clamped to 
the size of the drawable in ANGLE. According to a reading of the man pages and 
spec, it seems that the only clamping that should be occurring is to 
GL_MAX_VIEWPORT_DIMS.

The clamping occurs in Context::applyRenderTarget and seems to be necessary 
because of the semantics of IDirect3DDevice9::SetViewport, which fails if the 
viewport "describes a region that cannot exist within the render target 
surface" [1].

This causes problems with applications that work in normalized device 
coordinates and correct for aspect ratio differences using the viewport.

In order to fix this it seems it will be necessary to send down another 
4-component vector to the vertex shader specifying an offset translation and 
scale to be applied to gl_Position. This would only be non-unity if the 
viewport ended up being clamped.

Test case and correct/incorrect images are attached.

[1] 
http://msdn.microsoft.com/en-us/library/windows/desktop/bb174469(v=VS.85).aspx

Original issue reported on code.google.com by kbr@chromium.org on 11 Oct 2011 at 6:10

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by kbr@chromium.org on 11 Oct 2011 at 7:18

GoogleCodeExporter commented 9 years ago

Original comment by nicolas....@gmail.com on 21 Dec 2011 at 9:25

GoogleCodeExporter commented 9 years ago
Fixed in r1952.

Original comment by nicolas....@gmail.com on 28 Feb 2013 at 11:43

GoogleCodeExporter commented 9 years ago
This is broken again.

Run the attached test the original comment. It looks correct on OpenGL and 
wrong on ANGLE.

Original comment by g...@chromium.org on 14 Mar 2013 at 10:51

GoogleCodeExporter commented 9 years ago
Added a WebGL conformance test
https://www.khronos.org/registry/webgl/sdk/tests/conformance/rendering/gl-viewpo
rt-test.html

Original comment by g...@chromium.org on 15 Mar 2013 at 2:33

GoogleCodeExporter commented 9 years ago
All works fine here. What branch/revision of ANGLE are you using?

Original comment by nicolas....@gmail.com on 15 Mar 2013 at 1:32

GoogleCodeExporter commented 9 years ago
Gregg's new test fails on Chrome Canary (ANGLE r1994) but at least as far back 
as r1562, which is in Chrome Stable. Passing --use-gl=desktop makes the test 
pass. It's also failing in Firefox 19.0.2. Windows 7, Quadro 600, 314.07 
drivers.

Original comment by kbr@chromium.org on 16 Mar 2013 at 4:16

GoogleCodeExporter commented 9 years ago
The r1952 fix is only in the dx11proto branch.  The revisions kbr quotes are on 
head.  

Original comment by dgk...@gmail.com on 22 Apr 2013 at 10:13

GoogleCodeExporter commented 9 years ago
With Chrome Canary now switched over to the ANGLE dx11proto branch, this seems 
to be working fine.

Original comment by nico...@transgaming.com on 17 Jul 2013 at 6:15