Bug 61854 - [nv50]glClipPlane not clipping correctly for glsl
Summary: [nv50]glClipPlane not clipping correctly for glsl
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/nouveau (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Nouveau Project
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-05 12:54 UTC by bill
Modified: 2013-03-07 19:43 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
blender file demonstrating FF vs GLSL behavior of glClipPlane (78.08 KB, text/plain)
2013-03-05 12:54 UTC, bill
Details

Description bill 2013-03-05 12:54:53 UTC
Created attachment 75953 [details]
blender file demonstrating FF vs GLSL behavior of glClipPlane

hw: NVIDIA Corporation G80 [GeForce 8800 GTS] (rev a2)


The problem was found using the alt-b clipping border option in blender.

In blender's default scene, press alt-b with the mouse in the 3d view and "select" part of the cube. It gets clipped properly. However, turn on matcap (press N to get the properties panel, scroll down and open the display sub-panel, and turn on "Matcap") and the clipping of the cube will depend on the viewer's position and angle with respect to the clipping planes. However, the highlighted wire-frame of the cube is always clipped correctly.

I was told by Ton (blender leader) that blender uses glClipPlane for the clipping border, and that enabling matcap simply causes blender to use glsl for the solid rendering.

Although I've included the url to the bug report in blender's bug tracker, I've also attached the same blend file to this report. For the blend file, turning off matcap will cause the cube to clip correctly, independently of the viewer's position and angle. Zooming in a little (mouse wheel) with matcap enabled will cause the cube's surface to become partially visible, but it will still be incorrect.

Blender bug tracker url: http://projects.blender.org/tracker/?func=detail&atid=231&aid=34492&group_id=9
Comment 1 bill 2013-03-07 13:01:27 UTC
Ok, thank's to calim's help, it turns out that blender wasn't writing to gl_ClipVertex. However, this is because __GLSL_CG_DATA_TYPES is not defined. Should nouveau define it? Or is there another define that can be used in blender's shader?
Comment 2 Christoph Bumiller 2013-03-07 18:35:51 UTC
__GLSL_CG_DATA_TYPES is an NV blob-specific feature related to Cg. How does that have anything to do with gl_ClipVertex ? And no, there's no way we're going to define it with mesa.
Comment 3 Christoph Bumiller 2013-03-07 19:43:17 UTC
blender's shader says:
"gl_ClipVertex works only on NVIDIA graphic cards so we have to check with __GLSL_CG_DATA_TYPES"

The GL 2.0 spec says:
"If gl ClipVertex is not written by the vertex shader, its value is undefined,
which implies that the results of clipping to any client-defined clip planes are also undefined."

I don't know with which driver they tested this (maybe on a gallium driver before gl_ClipVertex was handled, which came rather late ?), but they can't expect undefined behaviour to work everywhere.


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.