Commit Graph

210 Commits

Author SHA1 Message Date
Caolán McNamara
47d3e82e4f boost->std
Change-Id: I9b4f884c6313a53fea543ea6f93175205351ad14
Reviewed-on: https://gerrit.libreoffice.org/18517
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-09-13 19:38:08 +00:00
Miklos Vajna
29ec512e8c windows opengl: make sure mpLastContext is indeed the current context
There were two problems here:

1) The OpenGLContext ctor registered the instance on the list of
contexts, but platform-specific call (e.g. wglMakeCurrent()) was only
made later. Add a registerAsCurrent() member function that helps
ensuring that the last item in the context list is indeed the current
context.

2) OpenGLContext::prepareForYield() is called without the solar mutex
being locked, but it still assumes that the last context in the context
list is the thread's current context, which may not be true.  The result
is that during JunitTest_sd_unoapi, we end up in a situation like:

debug:4640:5240: OpenGLContext::registerAsCurrent: wglGetCurrentContext() is 00010001, pSVData->maGDIData.mpLastContext is 00FA65F8
debug:4640:7944: OpenGLContext::registerAsCurrent: wglGetCurrentContext() is 000D0003, pSVData->maGDIData.mpLastContext is 00FA6C70
debug:4640:5240: OpenGLContext::prepareForYield: start, wglGetCurrentContext() is 00010001, pSVData->maGDIData.mpLastContext is 00FA6C70

I.e. one thread registers as current, an other registers as current, too (while
the other thread has the solar mutex), then once the original thread wants to
release the solar mutex, the real current context and the last item in the
context list won't match, so the assert at the end of prepareForYield() will
fail.

Fix this by releasing the GL context in WinSalInstance::DestroyFrame().

With this, JunitTest_sd_unoapi passes on Windows with GL enabled.

Change-Id: Icfb9c65c871586b5df69b5a2ab3aa91843dfc799
Reviewed-on: https://gerrit.libreoffice.org/18473
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2015-09-11 06:55:54 +00:00
Caolán McNamara
5094b783fa coverity#1323759 Uninitialized pointer field
Change-Id: I9fca8838beb1c2f6db8a9f1c9b6fe77f247b847c
2015-09-10 21:10:10 +01:00
Miklos Vajna
57fc41adc9 windows opengl: mpCurrentProgram seen as 0
in JunitTest_sc_unoapi_3.

Change-Id: Ibe12a31c1158f782bd7df115171b07e1843d025c
2015-09-10 13:51:49 +02:00
Michael Meeks
82d25c02f8 tdf#94006 - need an explicit dispose for GLContext's SystemChildWindow.
Previously we would get an explicit ~OpenGLContext - and potentially
leave FMR's around for other OGC users, now we treat the other users
properly - we need an explicit dispose() to get Window::dispose ordering
right.

Change-Id: I5edcbd73399b6db3dbcfb391570f364f9ab0c70d
Reviewed-on: https://gerrit.libreoffice.org/18412
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2015-09-08 15:47:49 +00:00
Michael Meeks
56900a441d tdf#94006 - fix OpenGLContext mis-use in several places.
gltf rendering, OpenGL canvas, GL transitions & GL capable (charts)
Avoid GLX operations on un-initialized contexts.

Change-Id: I7f523640f66ab656896181e5c865879234f6640e
2015-09-08 13:04:02 +01:00
Michael Meeks
2456cf8306 tdf#94006 - re-factor to use rtl::Reference for OpenGLContexts.
Don't use rtl::Reference for the global / list state, so the
ref-count reflects the number of real users.
Hold a reference during ~OpenGLContext.

Change-Id: I4e57a7246159acd58ae7d5a0dfc8704b9795c894
2015-09-08 13:04:02 +01:00
Markus Mohrhard
c94d60d6c1 don't use a null display
Change-Id: Iab0a53abd723f0309f40742636315079a4b2c532
2015-09-07 22:33:56 +02:00
Markus Mohrhard
4ff0032528 avoid some OpenGL calls when vcl OpenGL is not enabled
There are even more and it is causing a number of performance issues.
This just fixes the most obvious place.

Change-Id: Id85c13b5b7f4bb0bc077e62c39258067e17c0094
2015-09-07 21:15:51 +02:00
Markus Mohrhard
7ce77fcfce prevent crash with non-vcl OpenGL contexts
Change-Id: Ia829b0f723c8ded1237e52d48f034da3c1ac249e
2015-09-07 16:41:11 +02:00
Tor Lillqvist
091723f7fd Avoid a SAL_INFO about OpenGL when not using OpenGL
Change-Id: Ia066c240776cecc855b59ab0ccc84e7fdcbf4b79
2015-09-04 16:58:16 +03:00
Michael Meeks
16b0e217c1 tdf#93867 - clear current GL context before thread switch.
Fixes regression from otherwise a nice cleanup in:
    d20092259c

Also get polarity of debug logging only with a context right.

Change-Id: Id322471f01e5656e758aefc57b0d4d5ad073ec54
2015-09-02 22:46:48 +01:00
Michael Meeks
7164ec07ca Don't call GL debugging methods if there is no context.
Change-Id: Ie6b824953b8ad19fd1b6a146cb6bf52bbb152ef7
Reviewed-on: https://gerrit.libreoffice.org/18276
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2015-09-02 17:37:11 +00:00
Jan Holesovsky
3c046ac76f windows opengl: Avoid an unnecessary wglMakeCurrent() call.
Change-Id: I1c1287a29067c053565c49c0ce96918a2d27d87f
2015-09-02 11:37:17 +02:00
Jan Holesovsky
fec95ebb06 windows opengl: When the 2nd param is NULL, the 1st is ignored anyway.
Change-Id: I840e8bb2d2ccae869c330bb32dba484b4a835a51
2015-09-01 18:38:27 +02:00
Michael Meeks
6a12aecf6f tdf#93839 - Encourage vdevs to pick up new GL Contexts when they go invalid.
Change-Id: I21726d0dd052fdc87e8dd36ff7122518325f6313
2015-09-01 15:16:08 +01:00
Jan Holesovsky
aefb3d973c windows opengl: Call InitGLEWDebugging() after we have the context.
Change-Id: I1582443cf6799dd73a3909660d524eaacbc2d909
2015-09-01 14:50:19 +02:00
Miklos Vajna
dbf5882af3 Revert "windows opengl: Set PFD_DOUBLEBUFFER even for single buffer rendering"
This reverts commit 6fd7199230. Kendy says the
original problem can't be reproduced anymore, and most unexpected flickering
goes away with this for my nvidia card.

Also, it's a good idea in general to keep PFD_DOUBLEBUFFER and
WGL_DOUBLE_BUFFER_ARB in sync, which is now the case.

Change-Id: I7a809d1c85be4206c01720d5de9b0a5617a59c87
2015-09-01 09:40:15 +02:00
Michael Meeks
b27b9084c5 tdf#93772 - handle framebuffer unbinding on GL context switch.
Also start gl tests in vcldemo:
    $ SAL_FORCEGL=1 vcldemo --gltests

Change-Id: I8f0022770d57cd60c830659e3f7fcc0721320a10
Reviewed-on: https://gerrit.libreoffice.org/18132
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2015-08-31 19:48:14 +00:00
Michael Meeks
18dd07ba4f tdf#93751 - ensure textures are unbound from framebuffers post destroy.
Change-Id: I81aec0e6f8db57905826c54c3442528be6068700
2015-08-31 20:18:54 +01:00
Thorsten Behrens
751c5f5b75 Revert "werror: fix build in vcl"
This reverts commit 5191fcb116.
Earlier, better fix was 831c69f939
2015-08-31 15:49:17 +02:00
Thorsten Behrens
5191fcb116 werror: fix build in vcl
Change-Id: I30f9e1858c90943e1d369aeea02e10d8037a4ca8
2015-08-30 00:35:44 +02:00
Michael Meeks
d421ba3b66 Add missing helpful GL trace messages outside of the impl. itself.
Change-Id: I5b71e3c9edc3e1e89e52c2e17b5fe0a025ac66ea
2015-08-28 17:33:32 +01:00
Michael Meeks
b051c3716a tdf#93529 - add glDebugMessageInsert wrappers to help with API tracing.
Change-Id: Icf75e0e477be1b2bbbe5095aee33e681d212be0b
2015-08-28 11:31:38 +01:00
Michael Meeks
098f9189c6 tdf#93530 - glClear our depth, stencil and buffer contents on init.
Change-Id: I117fd5f5fd12fd6534b9d10532a39807ad82ce71
Reviewed-on: https://gerrit.libreoffice.org/18069
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2015-08-28 00:18:59 +00:00
Michael Meeks
d20e7e3864 tdf#93547 - Disable OpenGL if we have a SEGV on windows in that code.
Annotate when we are in an OpenGL rendering zone.
Check for this in the VCL signal handler, and force OpenGL off here
if exception occurred inside an OpenGL code-path.

Change-Id: I85a4b3d4a374593dc55d01a39ec4c7c3c262c332
Reviewed-on: https://gerrit.libreoffice.org/17881
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2015-08-21 06:43:48 +00:00
Miklos Vajna
a00df90e18 vcl opengl: fix setting up debug context on Windows
At least with my AMD card, in case of SAL_FORCEGL=1 the startup crashes
quite early. DrMemory says:

~~Dr.M~~ Error #1: UNADDRESSABLE ACCESS: writing 0x00001414-0x00001415 1 byte(s)
~~Dr.M~~ # 0 atioglxx.dll!DrvPresentBuffers                          +0xd6ea6  (0x09a248f6 <atioglxx.dll+0x1248f6>)
~~Dr.M~~ # 1 atioglxx.dll!DrvPresentBuffers                          +0x3c069c (0x09d0e0ed <atioglxx.dll+0x40e0ed>)
~~Dr.M~~ # 2 vcllo.dll!OpenGLContext::InitGLEW                        [c:\lo\master\vcl\source\opengl\openglcontext.cxx:949]
~~Dr.M~~ # 3 vcllo.dll!OpenGLContext::ImplInit                        [c:\lo\master\vcl\source\opengl\openglcontext.cxx:866]
~~Dr.M~~ # 4 vcllo.dll!OpenGLContext::init                            [c:\lo\master\vcl\source\opengl\openglcontext.cxx:786]
~~Dr.M~~ # 5 vcllo.dll!WinOpenGLSalGraphicsImpl::CreateWinContext     [c:\lo\master\vcl\opengl\win\gdiimpl.cxx:36]

Turns out that in order to enable the GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
extension, the GL context must be created with WGL_CONTEXT_DEBUG_BIT_ARB
set. It seems that other drivers did not enforce this so far, but in
this case the driver just crashes without this.

Fix the problem by splitting out the debug setup part of InitGLEW() into
a new InitGLEWDebugging(), and at least on Windows call it only after
wglCreateContextAttribsARB() and wglMakeCurrent(). Additionally make
sure that in the debug case the necessary flag is passed to
wglCreateContextAttribsARB().

Change-Id: I6b77e0c06fd85fdae0386a0801f1de1838524586
Reviewed-on: https://gerrit.libreoffice.org/17750
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2015-08-14 09:58:15 +00:00
Noel Grandin
449d272daf loplugin:unusedmethods vcl
Change-Id: I98b88ca3369a2c888fd63796e39d42376d513002
2015-07-08 09:51:27 +02:00
Tor Lillqvist
e03244c94d Fix Funky Capitalisation Of Comments
Change-Id: I2846824d402d029cde8d214f8112047243c79c54
2015-07-06 17:33:04 +03:00
Andrea Gelmini
462e986e0d Fix typos
Change-Id: Id9296115f30858e7fd470a199e59343a96d7deec
Reviewed-on: https://gerrit.libreoffice.org/16712
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
2015-07-04 10:18:19 +00:00
Stephan Bergmann
83fc2cfb34 loplugin:checkconfigmacros
Change-Id: Ia94c53457e328db9bdd8dd22d7a39e49c358301c
2015-06-18 14:42:03 +02:00
David Tardon
2703f4d843 continue to support glew 1.10
Change-Id: I951c04e7d0039f1e38e3bcb2ea7e0f7c33293b9b
2015-06-18 10:16:02 +02:00
Takeshi Abe
0980095619 Replace boost::scoped_array<T> with std::unique_ptr<T[]>
This may reduce some degree of dependency on boost.
Done by running a script like:

git grep -l '#include  *.boost/scoped_array.hpp.' \
 | xargs sed -i -e 's@#include  *.boost/scoped_array.hpp.@#include <memory>@'
git grep -l '\(boost::\)\?scoped_array<\([^<>]*\)>' \
 | xargs sed -i -e 's/\(boost::\)\?scoped_array<\([^<>]*\)>/std::unique_ptr<\2[]>/'

... and then killing duplicate or unnecessary includes,
while changing manually
m_xOutlineStylesCandidates in xmloff/source/text/txtimp.cxx,
extensions/source/ole/unoconversionutilities.hxx, and
extensions/source/ole/oleobjw.cxx.

Change-Id: I3955ed3ad99b94499a7bd0e6e3a09078771f9bfd
Reviewed-on: https://gerrit.libreoffice.org/16289
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-06-17 15:50:45 +00:00
Tor Lillqvist
a1a0432d11 Const correctness
Change-Id: I786b9590f8179a1f6c6593b7ff1dec286adda192
2015-06-17 17:19:14 +03:00
Markus Mohrhard
b6d0c53e51 get rid of a few thousand unnecessary OpenGL calls
For each iteration of the (gtk) main loop we are dropping the yield
mutext which results in calling OpenGLContext::clearCurrent. That method
calls OpenGLContext::ReleaseFramebuffers which would call in the end
glBindFramebuffer for each framebuffer related to that context.

This would easily grow into the thousand OpenGL calls without doing any
work.

Change-Id: I209cc534fe58a5e11ef7df7f850a787916b8bd43
Reviewed-on: https://gerrit.libreoffice.org/16241
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2015-06-12 13:24:03 +00:00
Stephan Bergmann
f6ec07a396 loplugin:cstylecast: deal with remaining pointer casts
Change-Id: I07bf1403e6b992807541a499b786d47f835b2f81
2015-06-08 16:29:41 +02:00
Noel Grandin
f3331f7694 convert PARENTCLIPMODE constants to scoped enum
Change-Id: I36a53112e75fca9208b2f91e224a7c671695509b
2015-05-28 12:47:08 +02:00
Stephan Bergmann
6183a945de False loplugin:staticmethods
Change-Id: Icc026ebb422c299caca6c24d6a56416076589fc8
2015-05-08 23:47:25 +02:00
Michael Meeks
bd4388e4f9 Use shared_ptr for OpenGLPrograms, and hide its copy constructor.
Change-Id: Ia1352105acef1ededaf876a224ebc277121d6942
2015-04-23 13:47:02 +01:00
Michael Meeks
4fed8865be vcl: convert new to ::Create
Change-Id: Ifd52953086ea923fa1770892d13f32c2263aec54
2015-04-20 15:35:54 +01:00
Michael Meeks
318dc66b77 Use the new ::Create template method.
Change-Id: I79e15b45769ced44b1679943972f7a71c7df8fca
2015-04-13 21:46:06 +01:00
Michael Meeks
7377c4d6dd Remove OpenGLContext GC window.
Change-Id: I1468fc94aa0c709528a767b96bc26eefdb7ed08f
2015-04-10 14:08:12 +01:00
Noel Grandin
808f69e3b7 vclwidget: improve detection of vcl::Window fields
that need to be wrapped in VclPtr, and convert several sites

Change-Id: I1fb1ed164a99642a0c1ccbf433eb14df688fa476
2015-04-10 11:01:34 +01:00
Noel Grandin
3e672693e3 loplugin:staticfunction
Change-Id: I909cf7e77f9d7194575636248196fda311fffdb6
2015-04-01 10:37:02 +02:00
Stephan Bergmann
62e798c4a5 Reduce to static_cast any reinterpret_cast from void pointers
Change-Id: I65d76524847b57dcb17ee3f66e156ec1fd51b239
2015-03-31 13:17:42 +02:00
Stephan Bergmann
18804c92e1 Clean up C-style casts from pointers to void
Change-Id: Iad602cece6e328c7f5d5f36adb294c97b152ade3
2015-03-28 19:09:28 +01:00
Jan Holesovsky
3637dc8a57 opengl: We need to return the GLWindow.
Fixes an unitialized read in wglDeleteContext, thanks Dr.Memory!

Change-Id: I3706b18526c48277f9b4a6801c95c26a10a86965
2015-03-19 18:11:57 +01:00
Caolán McNamara
32f95a3551 V813: Decreased performance
Change-Id: I8a7528366156b288dc422b09cff0d5a32cde3c91
2015-03-04 13:07:40 +00:00
Stephan Bergmann
fa50edeb72 Remove references to unused GLU
(after removing the one remaining use of gluErrorString in a SAL_WARN call)

Change-Id: Ib94e346d73e508e69c07deafdc690e3ae0e23d4e
2015-03-02 20:23:57 +01:00
Caolán McNamara
a1ceacc17e boost::foo_ptr->std::foo_ptr
Change-Id: I9219619b538b6530a89f5932ac51eb3b62eb396a
2015-02-16 12:54:44 +00:00