summaryrefslogtreecommitdiff
path: root/vcl/source/opengl
AgeCommit message (Collapse)AuthorFilesLines
2016-07-20tdf#95857 Sort out German plurals ...danielt9981-2/+2
Made a start in removing the incorrect 'Infos' German plural Reviewed-on: https://gerrit.libreoffice.org/22301 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> (cherry picked from commit 2b31daf74e33b988c849cb26e88fa7657a4015af) Change-Id: Ie989351a7473fc35b563e63ce6a4fb229093af60
2016-07-20vcl: bmpacc.hxx -> bitmapaccess.hxxChris Sherlock2-2/+2
(cherry picked from commit 88730cdae3520b18fc073dc59bd0ed660e15d6b4) Change-Id: I4bb19d6103c4a6a902d86b62a857e3478493924c
2016-07-12Remove excess newlinesChris Sherlock1-1/+0
A ridiculously fast way of doing this is: for i in $(pcregrep -l -M -r --include='.*[hc]xx$' \ --exclude-dir=workdir --exclude-dir=instdir '^ {3,}' .) do perl -0777 -i -pe 's/^ {3,}/ /gm' $i done Reviewed-on: https://gerrit.libreoffice.org/22224 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> (cherry picked from commit a238b1f8d304bf1e2ffb357937f3ec888ee8ac89) Change-Id: Iebb93eccbee9e4fc5c4380474ba595858a27ac2c
2016-07-12vcl: fix loplugin:stylepoliceMiklos Vajna1-4/+4
Change-Id: I40455e04a5f69dc0956ccb01c48d8a40245a4506 (cherry picked from commit 2465cb26763b2ed8de65f35bce791fb55fe0e746)
2016-05-31tdf#100159: On Windows, compile GL shaders in advance, disable GL on failureTor Lillqvist2-5/+113
This is a combination of multiple commits in master, adapted for this branch as necessary: Don't claim to be reading a file before trying to open it Avoid redundancy: The same information was logged in readProgramBinary() Use VCL_GL_INFO here Failing to open a cached shader binary is a no reason for a SAL_WARN. It is normal that they don't exist when first trying, that is the very nature of a 'cache'. Move exithelper.h to include. We will want to use EXITHELPER_NORMAL_RESTART in vcl, too. If the shader compilation or loading of an already compiled shader fails, disable OpenGL in the registry and exit with the EXITHELPER_NORMAL_RESTART status. The wrapper process will thus run soffice.bin once more, and this time OpenGL will not be used. Change-Id: I54d92f150975d3fa72d93f3f679b16c90ee38f02 Reviewed-on: https://gerrit.libreoffice.org/25708 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
2016-05-25opengl: track the state of blend, DrawArrays on OpenGLProgramTomaž Vajngerl1-1/+5
This adds tracking of GL_BLEND and glBlendFunc which are usually set when setting up the current draw call on OpenGLProgram with SetBlendFunc method. Until now the final draw call (glDrawArrays) was called outside of OpenGLProgram. This is a problem because we need to know if we did call SetBlendFunc or not between when we used or reused the current program. So we added DrawArrays to OpenGLProgram and refactored all draw calls in OpenGLSalGraphicsImpl to use this. From now on glDrawArrays should not be called directly but always through OpenGLProgram. (cherry picked from commit e480b2cf3e362760de8e35cbb950104e47ebe7ec) Change-Id: I530b4b948af8a962669a3751e1a95ff3986ffec9 Reviewed-on: https://gerrit.libreoffice.org/25359 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2016-05-06opengl: combined commits for state trackingTomaž Vajngerl1-2/+6
Includes commits: opengl: track state of active and bound textures in context ba0a5708803d899de4c40cfe2c1697ae83b4827a opengl: track the state of scissor test and the dimensions 51e953a3579fb91f30f7f0d6159b737684976959 opengl: track the state of stencil test b8f0e6452cc019744c44997c92831d94086b35b7 opengl: sync scissor and stencil state, generic capability state a57d048f88ba6cac3ce1550e2a8a143a8887eb05 opengl: track the state of glViewport 540fee2dc7553152914f7f1d8a41921e765087ef Change-Id: I770a6a744c0c41850c576b928f027375962088aa Reviewed-on: https://gerrit.libreoffice.org/24508 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: David Tardon <dtardon@redhat.com>
2016-04-05opengl: fix loading shader with preamble that uses #versionTomaž Vajngerl1-2/+2
The preamble was inserted into a false position so the shader could was constructed incorrectly and would fail to compile. Change-Id: I4c51adde9014a326bbe38a5d2d17dd0047e33195 Reviewed-on: https://gerrit.libreoffice.org/23463 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: David Tardon <dtardon@redhat.com>
2016-03-15vcl: move graph.[hx]xx to graphic.[hc]xxChris Sherlock2-2/+2
It's IMO a bit confusing to see a "graph" header that doesn't strictly deal with graphs, but graphics. Backporting to 5.1 series to allow for easier backporting of other potential hotfixes. Change-Id: Ic37c6cd78e23d05939486f98667144c4453bb0a3 Reviewed-on: https://gerrit.libreoffice.org/22949 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2016-02-08tdf#97633 Add API to get the number of OpenGL buffer swaps, including ...Tor Lillqvist1-6/+17
... through UNO (cherry picked from commits dff18c2be9c72aa05940982f506804eb41d3d79a, 2c55288357c9d5410afae58c1fbb97cdfabf0360, 32d98b2551644dea50e58f99ae921a82a0f69753 and 4cd058f3f6568724c65ac88769f17fcc6078da23) Change-Id: Iff29ac615ad4b6516790b1cbbde0215a3cd0efe6 Reviewed-on: https://gerrit.libreoffice.org/22209 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2016-01-07Fix dbgutil build in case GL_DEBUG_SEVERITY_NOTIFICATION_ARB is undefinedTor Lillqvist1-0/+2
Change-Id: I14628e9dee8651e87b4782057c4681fded5e4643 (cherry picked from commit 1fd7994a4ea7daf8bdbf394f4d5cd8f678d00758)
2016-01-07OpenGL transitions: squashed 5 commits into this oneEmmanuel Gil Peyrot1-0/+6
vcl: Ignore i965’s shader compiler debug (cherry picked from commit 928fe134ff6ea85f732b36a1ab11336f1d829531) slideshow: Fix a few issues in the Glitter transition Remove an unused variable, add comments, reduce the time a tile stays black, and don’t rely on implicit casts of integers into floats. (cherry picked from commit 22480b20130d10f4691cdf0a658040be7f36e47b) slideshow: Improve the Ripple transition to match PowerPoint better (cherry picked from commit 1d411cad5a7d78ead8cffb5da522f1e0fba31187) slideshow: Improve the Vortex transition to match PowerPoint better (cherry picked from commit d886fef25c5978dd4b07fa0e3ce2402874a6c29a) slideshow: Define inverse() to bring back the GLSL version to 1.20 (cherry picked from commit a301da7cb6c562cd21983d9b3b34dc01235a82a5) Change-Id: Ifd33ae982b762af3ea8d88b2b2de259aabeebc9a Reviewed-on: https://gerrit.libreoffice.org/21116 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
2016-01-07vcl: opengl - Kill the last glErrors on common paths.Michael Meeks2-0/+43
Re-work the makeSomeOpenGLContextCurrent logic into a shared function with the existing AcquireContext logic in the SalOpenGLGraphics impl. Use an OpenGLVCLContextZone placeholder to do both context and zone management - to include destructors into the zone. Fix a number of error cases around SalBitmaps where we did not have a GL context associated when allocating, and/or freeing textures.. Don't drag a (potentially) slower context around in the OpenGLSalBitmap when we're going to check / fetch a better VCL context anyway. Remove ScaleOp pieces to synchronize with master for maintenance. Change-Id: Ibbb2358c47156cd078ad28b6aad4f03af36aaf23 Reviewed-on: https://gerrit.libreoffice.org/21149 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
2015-12-14vcl: use a custom tag for VCL OpenGLContext's to avoid re-use.Michael Meeks1-0/+1
Other code is out of legacy mode now, so can't legacy as a proxy. Change-Id: Ie3807a3af680b707f2f08d058db955bc9cae6c2b Reviewed-on: https://gerrit.libreoffice.org/20647 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2015-12-12opengl: Add Geometry Shader support to OpenGLHelperEmmanuel Gil Peyrot1-3/+59
This is the ground work for some later transitions in slideshow. Change-Id: Ib200cf7fabd579256a5255b0fb5d8c4accf7d24b (cherry picked from commit facfbeb5cbff191da956827bc37df7bc74ed0b81)
2015-12-11tdf#93529 - move to a Mac-like double-buffered OpenGL model.Michael Meeks1-0/+10
This moves us to always rendering to an off-screen texture, and then (at idle) blitting this to the screen & swapping buffers. Ideally we should never see any rendering, or flicker again with this approach. Several fixes are included: + avoid multiple OpenGL contexts being created for the same window, created excessive flicker problems. + de-virtualize UseContext - which context we use is less critical. + kill 'mbOffscreen' distinction - all VCL rendering is offscreen. + implement 'doFlush' and high priority idle flushing. + bind stencil buffer for clipping vs. textures - fixing complex clopping when rendering to virtual-devices, and off-screen. + document environment. variables. + use white as default background glClear color, but red or random color for DBGUTIL. Change-Id: I6be08595b6c8deb7e6db0dbd81308b2c97d2b4ff
2015-12-11Get Double-buffered context creation working on linux.Michael Meeks1-6/+7
Change-Id: I3db1d6792fcd51577f047b82029124ec825ea319
2015-11-20loplugin:sallogareasStephan Bergmann2-19/+19
Change-Id: Ib1f06cb5f925535858bc14aab6f59ad7fd2a3a8d
2015-11-19readabilityTomaž Vajngerl1-1/+4
Change-Id: I8fbff3f86a543a58259408914bb78f992ad65864
2015-11-19loplugin:nullptrStephan Bergmann1-2/+2
Change-Id: Ie461bc10ee2f7d2329a23c86bdc922839bea7974
2015-11-19Add OpenGLContext::UseNoProgram()Tor Lillqvist1-0/+10
Will be useful in cases where there is some external library code that uses shaders outside of our OpenGLContext. Change-Id: I59c57e3225f55d13e69b6a9b7c0db1a7487c586d
2015-11-19Improve SAL_WARN message readabilityTor Lillqvist1-1/+1
Change-Id: Ia9e1ea7a69e372725a4239fad2630b6f8bcb52e2
2015-11-17Check for OpenGL errors right where an error might be generatedTor Lillqvist1-1/+1
CHECK_GL_ERROR() is now zero-cost in a production build, so no reason to avoid it. Don't check for OpenGL errors after glX or wgl calls. They don't generate OpenGL errors but use the X and Win32 error mechanisms, as far as I see. Change-Id: I8f97ef434cbdc89d6e345a247456cfc4a1a82bb6
2015-11-16opengl: remove unused mbPixmap & glPix members.Michael Meeks1-24/+11
We use textures bound to FBO's for everything in recent times. Change-Id: I7c9068d75b3653a2ceff0056e2ade1f27955422f Reviewed-on: https://gerrit.libreoffice.org/19995 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2015-11-16Add comment to 'direct' parameter: un-related to double-buffering.Michael Meeks1-2/+2
Change-Id: I07002fd73fc004439aea75c5aca8ca3700ec1079 Reviewed-on: https://gerrit.libreoffice.org/19996 Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com> Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2015-11-13OpenGL error codes are defined in hex, so show them as suchTor Lillqvist1-4/+3
Change-Id: I1f7fd98b243c49bfd90060b297bb2391cb102bb3
2015-11-11Move checkExtension() to a more private locationTor Lillqvist1-0/+40
Change-Id: I9f8a4ca0991b59bb9b6af4d40e3136ce5c986731
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann2-52/+52
Change-Id: I05e89f9896170d4df3d1377549ea074f06b884a0
2015-11-10Surely a 24-bit depth buffer is enoughTor Lillqvist1-1/+1
We asked for a 64-bit one, which is rather preposterous. And the comment claimed we asked for a 32-bit one. Funnily, this same odd code and comment is found in half a dozen code samples on the Internet... Copy pasta rules. Change-Id: Ie54a7b75e07cfe0ffd98ec330ce63158d2d15415
2015-11-10Add some assertions and improve commentsTor Lillqvist1-2/+9
Make sure the hardcoded indexes into the iAttributes array that we use mean what they are supposed to. Add comments about that, and fix one misleading comment. Change-Id: Ibb748b00782db4fcaf34f6c717075f6aff50651e
2015-11-05use uno::Reference::set method instead of assignmentNoel Grandin1-1/+1
Change-Id: I31a69a997098eb1807361b8049c3312a4f287d75
2015-10-19Speed up in-process caching of OpenGL shader programsTor Lillqvist1-7/+15
It seems to be fairly CPU intensive to calculate the MD5 digest of shader program source code. But we don't need to use that to look up a corrresponding program in the run-time in-process cache anyway. The shader names are unique, so it is enough to use that as key. Change-Id: I8fd9f5f875be14a82cd53daf8a2ca72bfd23beb6
2015-10-18Success is no reason to be scaredTor Lillqvist1-3/+3
Change-Id: If7ad24bf1f7442e86d424188bd78f332b1a351ff
2015-10-11Moggi thinks this mutex is unnecessary and I trust himTor Lillqvist1-3/+0
"Is the mutex really necessary? Normally outside of the chart OpenGL only the thread that has taken the SolarMutex should access the OpenGL code. In general we have bigger problems if several threads start rendering in parallel." Change-Id: I5f8fa8c771d5e2e0df4cfe903b15d00e5cc162b1
2015-10-09clang-analyzer-deadcode.DeadStoresStephan Bergmann1-1/+0
Change-Id: I8a6ea395192d31391868f44152ab3b543a07aeaa
2015-10-08Don't re-read the same glsl files over and over againTor Lillqvist1-4/+20
Change-Id: I10b4badaba01630e1a054b3d4d9cc4720822511a
2015-09-30vcl: clean up before error returns in OpenGLContext::ImplInit()Michael Stahl1-0/+10
JunitTest_chart_unoapi fails here with "assert(!hasCurrent())" because the initialization apparently fails due to lack of a wglCreateContextAttribsARB in the VM, so ensure that the hTempRC is not active and also deleted in all cases. Change-Id: I7e03b95d1146af48a24e34692c3c2827298fccee
2015-09-16Add debugging helpers to binary shader loading.Michael Meeks1-5/+4
Change-Id: I32b8d8ce0fbf824120c8afd288b728314cd74142 Reviewed-on: https://gerrit.libreoffice.org/18620 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2015-09-16GL paint-flushing guard re-work.Michael Meeks1-1/+45
Unfortunately, since we can have 2x SalGraphics' on a OutputDevice, and one of these can be a printer - things got very confused around which context to glFlush. This de-tangles the various reference-counts. Change-Id: I1062be0b02a91fc9009deaa3ec29c5dbb227df20 Reviewed-on: https://gerrit.libreoffice.org/18604 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
2015-09-16tdf#94213 - release offscreen texture properly on re-size.Michael Meeks1-0/+3
We need to ensure that we use an initialized context, and that (when we re-parent) we DeInit and so reset the previous OpenGLContext. Make UseContext more paranoid as well for good measure. Change-Id: Ia45334222045e5d2f48da47560fab8511223a9a5 Reviewed-on: https://gerrit.libreoffice.org/18601 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2015-09-15loplugin:cstylecastStephan Bergmann1-3/+3
Change-Id: Ib87c2d84bc954e768a9a5165f528936aafa94887
2015-09-15WaE: loplugin:cstylecastTor Lillqvist1-4/+4
Change-Id: I08c31a7e097464da5df4fcda6637f442d147230f
2015-09-15tdf#93814: Added support for caching shader program binaries.Marco Cecchetti2-29/+272
Change-Id: I21c844b47282f6b3eec443933a86421a074e24df Reviewed-on: https://gerrit.libreoffice.org/18555 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2015-09-13boost->stdCaolán McNamara1-4/+3
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-11coverity#1323754 we apparently can survive std::abort for a whileCaolán McNamara1-0/+1
so try and suppress this warning Change-Id: I096352af0116f1ba0911cc201eb884267095a797
2015-09-11windows opengl: make sure mpLastContext is indeed the current contextMiklos Vajna1-2/+11
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-10coverity#1323759 Uninitialized pointer fieldCaolán McNamara1-2/+3
Change-Id: I9fca8838beb1c2f6db8a9f1c9b6fe77f247b847c
2015-09-10windows opengl: mpCurrentProgram seen as 0Miklos Vajna1-0/+7
in JunitTest_sc_unoapi_3. Change-Id: Ibe12a31c1158f782bd7df115171b07e1843d025c
2015-09-08tdf#94006 - need an explicit dispose for GLContext's SystemChildWindow.Michael Meeks1-0/+9
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-08tdf#94006 - fix OpenGLContext mis-use in several places.Michael Meeks1-4/+7
gltf rendering, OpenGL canvas, GL transitions & GL capable (charts) Avoid GLX operations on un-initialized contexts. Change-Id: I7f523640f66ab656896181e5c865879234f6640e