Merge lp:~3v1n0/unity/fix-nvidia-glDrawArrays-crash into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 2536
Proposed branch: lp:~3v1n0/unity/fix-nvidia-glDrawArrays-crash
Merge into: lp:unity
Diff against target: 31 lines (+14/-0)
1 file modified
plugins/unityshell/src/unityshell.cpp (+14/-0)
To merge this branch: bzr merge lp:~3v1n0/unity/fix-nvidia-glDrawArrays-crash
Reviewer Review Type Date Requested Status
jenkins (community) continuous-integration Needs Fixing
Daniel van Vugt Approve
Sam Spilsbury (community) Approve
Review via email: mp+117559@code.launchpad.net

Commit message

unityshell: fix the nvidia crash on glDrawArrays disabling/enabling the client state on nuxPrologue/Epilogue (LP: #982626) (LP: #1031554)

Description of the change

Fix some crashes with the NVIDIA driver, happening on glDrawArray call.
Thanks to Sam for the hint.

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Test coverage would be nice so that people don't accidentally nuke this code, though it would kinda involve wrapping those gl calls. Dunno if we want to do that.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Works for me. Crash fixed.

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/984/console reported an error when processing this lp:~3v1n0/unity/fix-nvidia-glDrawArrays-crash branch.
Not merging it.

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/987/console reported an error when processing this lp:~3v1n0/unity/fix-nvidia-glDrawArrays-crash branch.
Not merging it.

Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/unityshell.cpp'
2--- plugins/unityshell/src/unityshell.cpp 2012-07-30 17:12:48 +0000
3+++ plugins/unityshell/src/unityshell.cpp 2012-08-01 01:27:18 +0000
4@@ -501,6 +501,15 @@
5
6 glMatrixMode(GL_MODELVIEW);
7 glPushMatrix();
8+
9+ /* This is needed to Fix a crash in glDrawArrays with the NVIDIA driver
10+ * see bugs #1031554 and #982626.
11+ * The NVIDIA driver looks to see if the legacy GL_VERTEX_ARRAY,
12+ * GL_TEXTURE_COORDINATES_ARRAY and other such client states are enabled
13+ * first before checking if a vertex buffer is bound and will prefer the
14+ * client buffers over the the vertex buffer object. */
15+ glDisableClientState(GL_VERTEX_ARRAY);
16+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
17 #endif
18
19 glGetError();
20@@ -530,6 +539,11 @@
21 glReadBuffer(GL_BACK);
22
23 glPopAttrib();
24+
25+ /* Re-enable the client states that have been disabled in nuxPrologue, for
26+ * NVIDIA compatibility reasons */
27+ glEnableClientState(GL_VERTEX_ARRAY);
28+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
29 #else
30 #ifdef USE_GLES
31 glDepthRangef(0, 1);