Closed
Bug 956154
Opened 10 years ago
Closed 10 years ago
Remove GLContext's viewport stack
Categories
(Core :: Graphics, defect)
Core
Graphics
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: bjacob, Assigned: bjacob)
References
Details
(Whiteboard: [qa-])
Attachments
(2 files, 1 obsolete file)
9.61 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
3.19 KB,
patch
|
vlad
:
review+
|
Details | Diff | Splinter Review |
GLContext has the ability to push and pop (save and restore) the viewport rect. There was no need to implement such a stack, as there is already a stack in the c++ language and if we need to, we can achieve the same with it (RAII helper to save and restore the viewport rect).
Attachment #8355342 -
Flags: review?(jgilbert)
Er no, these are not equivalent. The previous push/pop always kept track of the current state of the viewport, and compared to that. Your ScopedViewport RAII class calls GetIntegerv first, which is bad -- no getters in normal code paths please! You can still keep the RAII class (and it's definitely nicer to have it), but please have GLContext or something keep track of the viewport. We should be tracking *more* GL state this way, not less.
Assignee | ||
Comment 2•10 years ago
|
||
Good point about the performance impact of relying on GL getters and the need to do our own tracking; but we can make both of us happy by tracking only the current viewport rect, so that glGetIntegerv(VIEWPORT_RECT) is fast regardless of the underlying GL, without implementing any stack on our side. I'll write that patch, if you don't disagree.
Yup, that sounds great. Having to pull the numbers out via the getter is a little unfortunate, but it will all likely get inlined and optimized away anyway.
(The call to glViewport should also do the comparison and not actually call the GL function if it doesn't need to; that's the potentially costly call, even with the same values.)
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8355562 -
Flags: review?(vladimir)
Comment 6•10 years ago
|
||
Comment on attachment 8355342 [details] [diff] [review] Remove GLContext's viewport stack Review of attachment 8355342 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/gl/ScopedGLHelpers.h @@ +208,5 @@ > protected: > void UnwrapImpl(); > }; > > +struct ScopedViewportRect Great!
Attachment #8355342 -
Flags: review?(jgilbert) → review+
Comment on attachment 8355562 [details] [diff] [review] Optimization: cache the viewport rect r- -- you're missing a "break;" in the case statement. Technically you can fix that and land with r+, but I'm wondering if that will change behaviour noticably?
Attachment #8355562 -
Flags: review?(vladimir) → review-
Assignee | ||
Comment 8•10 years ago
|
||
Ouch! The reason why this was not caught by any testing is that it was falling through to the generic path calling glGetIntegerv, so it was correct but slow.
r+ with the fix.
Assignee | ||
Comment 10•10 years ago
|
||
Attachment #8355562 -
Attachment is obsolete: true
Attachment #8356649 -
Flags: review?(vladimir)
Attachment #8356649 -
Flags: review?(vladimir) → review+
Assignee | ||
Comment 11•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/dad6e5e57b1e https://hg.mozilla.org/integration/mozilla-inbound/rev/886b3ccaaa3c
Assignee: nobody → bjacob
Target Milestone: --- → mozilla29
Comment 12•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/dad6e5e57b1e https://hg.mozilla.org/mozilla-central/rev/886b3ccaaa3c
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Updated•10 years ago
|
Whiteboard: [qa-]
You need to log in
before you can comment on or make changes to this bug.
Description
•