Last Comment Bug 618765 - unbind VBO required in order to share GL context with toolkit
: unbind VBO required in order to share GL context with toolkit
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: Trunk
: ARM MeeGo
: -- normal (vote)
: mozilla11
Assigned To: Oleg Romashin (:romaxa)
:
Mentors:
Depends on:
Blocks: 619056
  Show dependency treegraph
 
Reported: 2010-12-12 20:11 PST by Oleg Romashin (:romaxa)
Modified: 2012-02-01 13:59 PST (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Unbind Quad VBO (2.29 KB, patch)
2010-12-12 20:11 PST, Oleg Romashin (:romaxa)
vladimir: review-
Details | Diff | Splinter Review
Another version of patch, frontend only (2.08 KB, patch)
2011-11-15 19:12 PST, Oleg Romashin (:romaxa)
no flags Details | Diff | Splinter Review
Unbind VBO, Addressed vlad comments (1.63 KB, patch)
2011-11-16 13:14 PST, Oleg Romashin (:romaxa)
jmuizelaar: review+
Details | Diff | Splinter Review
Missing returns that also need unbind VBO (1.12 KB, patch)
2011-11-19 10:39 PST, Oleg Romashin (:romaxa)
matt.woodrow: review+
Details | Diff | Splinter Review

Description Oleg Romashin (:romaxa) 2010-12-12 20:11:17 PST
Created attachment 497211 [details] [diff] [review]
Unbind Quad VBO

On attempt to render mozilla layout with OGL Manager togeter with Qt/Meego toolkit items (statusbar, FPS renderer, and other possible items on QGraphicsScene) I see this error:
PVR:Aborting: Offset to VBO out of bounds. Likely an app bug in glVertexAttribPointer!

Comment from internal bugzilla:

**************
The error message you're getting indicates that the app is trying use geometry
from a vertex buffer object (VBO) with an offset that goes beyond the end of
the buffer. The most common cause for this is forgetting to unbind a VBO before
using a client-side vertex attribute array. For example:

    glVertexAttribPointer(attr, 3, GL_FLOAT, GL_FALSE, 0, &someArray[0]);

should be

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glVertexAttribPointer(attr, 3, GL_FLOAT, GL_FALSE, 0, &someArray[0]);

This is because if a vertex buffer object is bound when glVertexAttribPointer
is called, the last parameter is interpreted as an offset into the VBO instead
of an absolute memory pointer.
**************
Comment 1 Vladimir Vukicevic [:vlad] [:vladv] 2010-12-12 23:05:01 PST
Comment on attachment 497211 [details] [diff] [review]
Unbind Quad VBO

ugh.  this is a Qt bug, but we have to work around it (if it depends on GL state, it should set that state!).

No need for an UnbindQuadVBO function, it's got nothing to do with the Quad VBO.

We should bind buffer 0 again at the end of Initialize (like you have), and also at the end of Render.  No need to bind it at the end of every quad draw, and in fact that'll be pretty expensive.  (We actually want to do even fewer state changes in there, but at some point we'll want to add state tracking to GLContext to do that).  We shouldn't ever have Qt GL rendering in the middle of our own rendering, so as long as we return a GL state back to Qt, we should be fine.
Comment 2 Florian Hänel [:heeen] 2011-04-18 07:35:21 PDT
This longer happens, so I assume it got fixed through returning consistent state.
Comment 3 Oleg Romashin (:romaxa) 2011-11-15 19:12:41 PST
Created attachment 574772 [details] [diff] [review]
Another version of patch, frontend only

Problem still exists, and I see it from time to time.
Also this API needed for native Embedding, right after EndTransaction we must unbind vbo in order to get it working in embedding context
Comment 4 Oleg Romashin (:romaxa) 2011-11-16 13:14:55 PST
Created attachment 574977 [details] [diff] [review]
Unbind VBO, Addressed vlad comments
Comment 5 Jeff Muizelaar [:jrmuizel] 2011-11-16 16:28:28 PST
Comment on attachment 574977 [details] [diff] [review]
Unbind VBO, Addressed vlad comments

mwoodrow says this is fine.
Comment 7 Ed Morley [:emorley] 2011-11-19 05:14:43 PST
https://hg.mozilla.org/mozilla-central/rev/e52370a94c8d
Comment 8 Oleg Romashin (:romaxa) 2011-11-19 10:39:10 PST
Created attachment 575683 [details] [diff] [review]
Missing returns that also need unbind VBO

Forgot about earlier returns which also needs UnbindVBO
Comment 9 Oleg Romashin (:romaxa) 2011-11-19 10:39:35 PST
Need to land additional patch
Comment 10 Ed Morley [:emorley] 2011-11-20 14:19:33 PST
https://hg.mozilla.org/mozilla-central/rev/5ebeef1eabcb

Note You need to log in before you can comment on or make changes to this bug.