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

Proposed by Marco Trevisan (Treviño) on 2012-08-01
Status: Merged
Approved by: Łukasz Zemczak on 2012-08-03
Approved revision: 2396
Merged at revision: 2395
Proposed branch: lp:~3v1n0/unity/fix-nvidia-glDrawArrays-crash-5.0
Merge into: lp:unity/5.0
Prerequisite: lp:~thumper/unity/regional-damage-sru
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-5.0
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve on 2012-08-01
Sam Spilsbury (community) 2012-08-01 Approve on 2012-08-01
Review via email:

This proposal supersedes a proposal from 2012-08-01.

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.
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
Daniel van Vugt (vanvugt) wrote :

Just tested this fix upstream in Unity 6.0/Nux 3.0. It works. And is identical to this one.

review: Approve
Unity Merger (unity-merger) wrote :

The prerequisite lp:~thumper/unity/regional-damage-sru has not yet been merged into lp:unity/5.0.

Łukasz Zemczak (sil2100) wrote : Posted in a previous version of this proposal

I see a LOT of conflicts - the diff generated by this branch is also terrible. Is it all just because the prerequisite branch is not yet merged?

review: Needs Information
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal

sil, I forgot to make this request against the correct branch (lp:unity/5.0), this MR is already superseded, follow the top link to get the new request ;)

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-08-01 01:09:21 +0000
3+++ plugins/unityshell/src/unityshell.cpp 2012-08-01 01:09:21 +0000
4@@ -505,6 +505,15 @@
6 glMatrixMode(GL_MODELVIEW);
7 glPushMatrix();
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
19 glGetError();
20@@ -534,6 +543,11 @@
21 glReadBuffer(GL_BACK);
23 glPopAttrib();
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 glDepthRangef(0, 1);
31 //glViewport(-1, -1, 2, 2);


People subscribed via source and target branches