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

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: no longer in the source branch.
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
Sam Spilsbury (community) Approve
Review via email: mp+117555@code.launchpad.net

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.
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 :

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

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

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

Revision history for this message
Ł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
Revision history for this message
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 @@
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@@ -534,6 +543,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 glDepthRangef(0, 1);
31 //glViewport(-1, -1, 2, 2);

Subscribers

People subscribed via source and target branches