summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi
Commit message (Collapse)AuthorAgeFilesLines
...
* rhi: gl: Pick up context lossLaszlo Agocs2019-09-1313-31/+76
| | | | | | | | ...and change the return value of makeThreadLocalNativeContextCurrent() to a bool since we expect this to mirror QOpenGLContext::makeCurrent(). Change-Id: I339507152e461fe28fcf7fe777165e6d0072f055 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: metal: Configure the layer's opaque property as appropriateLaszlo Agocs2019-09-121-0/+12
| | | | | | Task-number: QTBUG-78089 Change-Id: I6cd95e24d38562cf1931c107bb6b719e340583a8 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Add a flag to indicate preferring a software adapterLaszlo Agocs2019-09-124-4/+60
| | | | | | | ...if there is one and the concept is applicable in the first place. Change-Id: Iab202c1c1cdd229f4910159de4cae7ce30805ea9 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: vulkan: Report device lostLaszlo Agocs2019-09-122-30/+38
| | | | | | | | | | | | Typically caught in vkQueueSubmit(). The WaitIdles that can be hit upon cleanup must be guarded by !deviceLost because they inexplicably cause an infinite blocking wait when the device was already reported as lost. (with NVIDIA at least) Change-Id: I7142e2461e1aed9ee3068b2b963cdf2c678ca4e0 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Better handling of device lossLaszlo Agocs2019-09-1213-3/+90
| | | | | | | Starting with D3D11. The other backends will follow later. Change-Id: I4f165c9f1743df0fb00bdce1e898917575bf5f6e Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Clarify the swapchain alpha flag docsLaszlo Agocs2019-09-121-2/+10
| | | | | Change-Id: Iff0edf0ae40b830af0209403d899def922e6088c Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: gl: Avoid crash when reading back the swapchain backbufferLaszlo Agocs2019-09-121-1/+2
| | | | | Change-Id: I9a632c06d8b9e666d99d0f135d3396d2de03f92a Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: d3d11: Fix enabling alpha compositingLaszlo Agocs2019-09-121-5/+16
| | | | | | Task-number: QTBUG-78089 Change-Id: I4e33665947debe007abcb976641e515224fa8451 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Make the clang code model happy as much as we canLaszlo Agocs2019-09-127-464/+470
| | | | | | | | | | | | | | | | When interfacing with reality (i.e. native platform APIs provided in C, ObjC, or COM), each of the APIs has its own idea of what types it likes to use for sizes, points, rects, etc. Out of the hundreds of warnings Qt Creator throws at us with the default clang check level when opening one of the rhi backends not a single one is useful. Regardless, let's try getting rid of what we can. This mostly involves throwing in int/uint conversions in order to get the signedness change warnings to shut up. The things that are either unacceptable to change or are beyond our control are left untouched. Change-Id: I6e4cb7cd373bf48dc990eaf83344242bbf30bd66 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: d3d11: Add the device lost testing machineryLaszlo Agocs2019-09-125-1/+290
| | | | | | | | | | | | | | | | | | | The device can be lost when physically removing the graphics adapter, disabling the driver (Device Manager), upgrading/uninstalling the graphics driver, and when it is reset due to an error. Some of these can (and should) be tested manually, but the last one has a convenient, programmatic way of triggering: by triggering the timeout detection and recovery (TDR) of WDDM. A compute shader with an infinite loop should trigger this after 2 seconds by default. All tests in tests/manual/rhi can now be started with a --curse <count> argument where <count> specifies the number of frames to render before breaking the device. Qt Quick will get an environment variable with similar semantics in a separate patch. Change-Id: I4b6f8d977a15b5b89d686b3973965df6435810ae Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: gl, metal, d3d: Reuse shader objects when source is the sameLaszlo Agocs2019-09-0913-141/+315
| | | | | | | | | | | | | | | | | | Now that Qt Quick's batch renderer misses one level of shader source caching due to the nature of pipeline state objects, it can be useful to keep and reuse shader objects when the hash of the source code matches. The goal here is to allow Qt Quick to be on par with what the direct OpenGL path has when it comes to caching shader sources and compilation results. The program binary disk cache is not in scope in this patch. Also adds QRhi::releaseCachedResources(), similarly to what the scenegraph has. This can be called to clear caches such as the shader object cache we keep here. Change-Id: Ie3d81d823f61fa65ec814439e882c498f7774d43 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* qrhid3d11: Remove unused variable blockDimMårten Nordheim2019-09-071-1/+0
| | | | | | | Clang emits a warning Change-Id: Ie2bf77248df2b2ecf23e24429688563f9725dd0d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: metal: Avoid upsetting validation in viewport and scissorLaszlo Agocs2019-09-061-2/+35
| | | | | | | | | | | | | | | | | When running with the threaded render loop of Qt Quick, it could be that the drawable changes size while the render thread prepares the command buffer with setViewport and setScissor. Those have no chance to see such changes, which is normally not a big problem because the resize will get processed eventually. However, in debug builds running in XCode, Metal validation checks the viewport and scissor rects against the (more or less) actual drawable size, and so would abort Qt Quick apps from time to time when resizing the window interactively. To solve this, we just query the drawable size in setViewport/setScissor to keep validation happy. Change-Id: I451f398bd1f88e3f49ea4624fc45bbb4b70e7f07 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix some qdoc warnings in 5.14Friedemann Kleint2019-09-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark QCalendarBackend as internal since it is in a private header and fix some issues in the QCalendar related classes. src/corelib/time/qcalendar.cpp:201: (qdoc) warning: clang found diagnostics parsing \fn int QCalendarBackend::daysInMonth(int month, int year) const error: incomplete type 'QCalendarBackend' named in nested name specifier (repeats) src/corelib/time/qdatetime.cpp:1426: (qdoc) warning: Unknown command '\override' (repeats) src/corelib/time/qcalendar.cpp:642: (qdoc) warning: Undocumented enum item 'Last' in QCalendar::System src/corelib/time/qcalendar.cpp:642: (qdoc) warning: Undocumented enum item 'User' in QCalendar::System src/corelib/time/qcalendar.cpp:744: (qdoc) warning: Undocumented parameter 'year' in QCalendar::isLeapYear() src/corelib/time/qcalendar.cpp:923: (qdoc) warning: Can't link to 'dateTimeString()' (repeats) src/corelib/time/qcalendar.cpp:893: (qdoc) warning: No such parameter 'year' in QCalendar::partsFromDate() src/corelib/time/qcalendar.cpp:893: (qdoc) warning: No such parameter 'month' in QCalendar::partsFromDate() src/corelib/time/qcalendar.cpp:893: (qdoc) warning: No such parameter 'day' in QCalendar::partsFromDate() src/corelib/time/qdatetime.cpp:1425: (qdoc) warning: Undocumented parameter 'nmonths' in QDate::addMonths() src/corelib/time/qdatetime.cpp:1467: (qdoc) warning: Undocumented parameter 'nyears' in QDate::addYears() src/corelib/statemachine/qstatemachine.cpp:2522: (qdoc) warning: Undocumented enum item 'StateMachineChildModeSetToParallelError' in QStateMachine::Error src/corelib/kernel/qtimer.cpp:602: (qdoc) warning: Undocumented parameter 'connectionType' in QTimer::callOnTimeout() src/corelib/time/qcalendar.cpp:159: (qdoc) warning: Undocumented parameter 'name' in QCalendarBackend::QCalendarBackend() src/corelib/time/qcalendar.cpp:159: (qdoc) warning: Undocumented parameter 'id' in QCalendarBackend::QCalendarBackend() src/corelib/time/qcalendar.cpp:529: (qdoc) warning: Can't link to 'registerCalendar()' src/corelib/time/qcalendar.cpp:529: (qdoc) warning: Can't link to 'fromName()' src/corelib/time/qcalendar.cpp:178: (qdoc) warning: Can't link to 'QCalendar::fromEnum()' src/corelib/time/qcalendar.cpp:405: (qdoc) warning: Undocumented parameter 'jd' in QCalendarBackend::dayOfWeek() src/corelib/time/qcalendar.cpp:405: (qdoc) warning: Can't link to 'weekDayName()' src/corelib/time/qcalendar.cpp:405: (qdoc) warning: Can't link to 'standaloneWeekDayName()' src/corelib/time/qcalendar.cpp:268: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:268: (qdoc) warning: Can't link to 'isLeapYear()' src/corelib/time/qcalendar.cpp:295: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:313: (qdoc) warning: Can't link to 'isLuniSolar()' src/corelib/time/qcalendar.cpp:313: (qdoc) warning: Can't link to 'isSolar()' src/corelib/time/qcalendar.cpp:313: (qdoc) warning: Can't link to 'isLunar()' src/corelib/time/qcalendar.cpp:340: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:357: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:544: (qdoc) warning: Can't link to 'fromName()' Change-Id: Ia2fabefb917f8e4cfa361044d9b754717276f4aa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* rhi: vulkan: Introduce secondary command buffer usageLaszlo Agocs2019-08-2913-172/+484
| | | | | | | | | | | As an option. Must opt in via setting ExternalContentsInPass in the flags for beginFrame(). It is somewhat unfortunate to require declaring this up front, but forcing using secondary command buffers always, even though beginExternal() may not be used in many applications, would be an overkill. Change-Id: I8d52bcab40c96f89f140c4c7877b6c459925e3c7 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: vulkan: Add missing VK_QUERY_RESULT_WAIT_BITLaszlo Agocs2019-08-291-1/+2
| | | | | | | Mainly to get the validation layer from newer Vulkan SDKs to shut up. Change-Id: I3a00d2e7b5617eb1656625b1b2a919bb3c07feb9 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Attempt to fix up the logic around beginExternal()Laszlo Agocs2019-08-296-67/+102
| | | | | | | | | | | | | | | | | | | | | | | | | Mainly for Vulkan where it lacked the recording of the still queued commands. Uncovered by Qt Quick examples that integrate custom Vulkan rendering. This still has an issue that needs to be tackled separately. (we probably will switch to using a dedicated secondary command buffer with RENDER_PASS_CONTINUE_BIT for the external commands, and then just have a vkCmdExecuteCommands in our own queue instead of recording everything in beginExternal). The possibility of losing glMemoryBarrier() calls due to begin/endExternal() with the OpenGL backend is fixed too. The logic here mirrors Vulkan to some extent except that we do not have a concept of (and so the trouble with) renderpass instances. Clean up around the implementations of finish() as well. Attempting to share code via a "flushCommandBuffer" function is admirable but is not worth it since some semantics are different. (finish() cannot be called within a begin/endPass, unlike begin/endExternal). Change-Id: I5137db598d6a40d484e53678f5c919abf750d9ed Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: vulkan: Expose the VkRenderPass via the usual mechanismsLaszlo Agocs2019-08-295-0/+38
| | | | | | | | | Qt Quick in turn will expose it via QSGRendererInterface. Essential when adding custom Vulkan rendering into a Qt Quick application because the custom pipeline state objects will need to reference a VkRenderPass. Change-Id: Idf4092cfc3937830fb8123164081059b0d8d030e Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Mark all rhi docs as internalLaszlo Agocs2019-08-278-61/+122
| | | | | | | | This is private API for the time being. Without this the QRhi* classes show up in the class list in the docs. Change-Id: I662abb9cc8eaae13ffe9266bd6313faa8e138353 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: d3d11: Rework swapchain effect handlingLaszlo Agocs2019-08-172-43/+75
| | | | | | | | | | | | | | | | | | | | | | | Use FLIP_DISCARD swapchains only on Win10, stick with DISCARD otherwise. This may fix the swapchain creation problems on Windows 7. Add a QT_D3D_NO_FLIP env.var. to make it possible to disable using FLIP_DISCARD even on Win10. This is there for troubleshooting purposes. Finally, fix the backbuffer handling. What we originally ported from the D3D12 backend of Qt Quick is not quite how DXGI used to work with D3D11 and earlier. GetBuffer() can only be used to query index 0, and that's the backbuffer, the rest is managed internally. Follow this model. As an added bonus, disable Alt+Enter. Change-Id: Ie5c7a1e813864e7f873d55bc72cb22fc09213a05 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: metal: Avoid flicker due to writing an in-use Managed bufferLaszlo Agocs2019-08-171-3/+5
| | | | | | | | | | | | | | | | | | | | | | | Qt Quick apps feature an occasional flicker which seems to be caused by updating the contents of a Static (or Immutable) QRhiBuffer in a frame where the QRhiBuffer in question is read in the previous frame as well. On macOS these types map to a Managed MTLBuffer and only one native buffer object (MTLBuffer). It seems modifying such a buffer is not safe if the previous frame has not completed. (this may be as expected, but hard to tell due to Metal's underdocumented automatic hazard tracking which we rely on atm) So for now switch to having 2 native buffers, like we do for Dynamic (on iOS/tvOS this would be the case anyway since there all buffers are host visible and slotted regardless of the QRhiBuffer type). This seems to solve the issue. To be seen if we want to move to a more Vulkan-like setup where Immutable and Static map to device local (Private). Change-Id: I76013f58a2e183ad8eab0705b28a03b395c4530c Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: gl: also enable point sprites on non-ESLaszlo Agocs2019-08-141-2/+7
| | | | | | | | | With GLES both point sprites and gl_PointSize in the vertex shader are implcitly enabled, but OpenGL has these as optional and must be enabled explicitly. Change-Id: I48cf6134f6bbd721cb938e2cad82d255cf4fb2cd Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: gl: Fix broken bgra textures on GLESLaszlo Agocs2019-08-141-3/+4
| | | | | | | | | Switching TexImage2D to the sized internal format was a bad idea. Go with what we do without the RHI in QtGui and elsewhere, and just pass the unsized GL_RGBA or GL_BGRA. Change-Id: I8216c0e49813355fa5e2594b24f06c64bc8e3873 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: gl: remove useless npot checksLaszlo Agocs2019-08-143-49/+12
| | | | | | | | | | | | | | | Adjusting the size is not very useful on its own. Leave it to Qt Quick or whoever provides the data to scale the source image data as they see fit. This is also more in line with other backends. While we are at it, update the feature flag documentation. It applies both to the repeat wrap mode and filtering modes other than nearest and linear (i.e. mipmapping). Change-Id: Ie28f1436b862335efeac042dc21e09189f46e626 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Avoid generating gl errors in ES 2.0 contextsLaszlo Agocs2019-08-142-5/+13
| | | | | | | | ...due to setting the unsupported texture compare mode. This keeps wasm happy (gl errors show up in the console there). Change-Id: I5de8bce8e793c709272f3df499d2320c7b07ff71 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* RHI/Windows: Fix launching of MSVC binaries on Windows 7Friedemann Kleint2019-08-131-10/+35
| | | | | | | | | Dynamically resolve CreateDXGIFactory2() which is not present on the platform. Task-number: QTBUG-76845 Change-Id: I4d15d72633544a8c11d2b78c8736cd20a2afdff1 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: Print the type of the resources in the leak checkLaszlo Agocs2019-08-071-2/+38
| | | | | | | | | | Also clarify what this check includes (backends are expected to register only QRhiResource instances that actually own native graphics objects - the ones that don't are not included in the leak checking) Change-Id: If0f43b302b148f043391fa7fd7bb77cfc8d93b79 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Add a note about size to newBuffer()Laszlo Agocs2019-08-022-4/+11
| | | | | | | Also make sure the gl backend is consistent with the other three. Change-Id: I2f6b783f5fa474c94ede460f5d7ac6fe8129a4f6 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: gl: Add support for bool members in uniform blocksLaszlo Agocs2019-08-021-0/+12
| | | | | | | | | Note that SPIRV-Cross does not translate 'bool' to GLSL versions that do not have uint. So in practice we will still need to use 'int' instead in shaders that also target old GL versions. Change-Id: I070f5414fe761796ab92937034b7182cdfb73a14 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Move info prints to categorized loggingLaszlo Agocs2019-08-026-19/+53
| | | | | | | | | | | Following the Quick scenegraph (qt.scenegraph.*), we now have qt.rhi.general. Other categories may get added later. This does not change the printing of real errors, those will continue to use qWarning(). Change-Id: Id95416fc82ba8add9527212e431bcbd47d416f1a Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: gl: Add support for computeLaszlo Agocs2019-07-315-254/+832
| | | | | | | ...and storage buffers and images. Change-Id: If38a51322e3187088a13cf4e9b88cb40c8af8621 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: metal: Do not hold on to the drawable when not presentingLaszlo Agocs2019-07-312-4/+13
| | | | | | | | | | | The Quick render loops do SkipPresent occasionally, and it all seemed to work with the threaded one because we lack an autorelease pool on the SG render thread. (to be corrected separately) The basic one ended up crashing sometimes, however. Holding on to the drawable is incorrect. Fixes: QTBUG-76953 Change-Id: I0d0ec6d09aa209d2c848d7a9dbd9b15916fe23ab Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: vulkan: Fix glitches on resize on X11Laszlo Agocs2019-07-311-0/+4
| | | | | | | | ...by notifying QVulkanInstance about the present. With the xcb platform this then gets turned into updating the sync request counter. Change-Id: Iecfb6d10ead3befcb24c19433d4712ed73a84bb4 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: gl: Fix feature version check logicLaszlo Agocs2019-07-221-7/+17
| | | | | | | | | It was somewhat incorrect in a few places. Some of these should be moved to QOpenGLFunctions/Extensions later. Change-Id: Ibc7a6409f16ddf1ad71230671dcad558dac1b86f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix a warning treated as error - 'importDevice not used'Timur Pocheptsov2019-07-031-0/+1
| | | | | Change-Id: Id48ff52d6532cf3585648addd498cdddccbcb994 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* RHI/D3D11: Remove hard dependency on D3DCompiler libraryFriedemann Kleint2019-07-022-2/+21
| | | | | | | | | | Varying versions of the library may be available depending on build tool chain or Windows version. Try to dynamically resolve the D3DCompile function. Fixes: QTBUG-76845 Change-Id: Ib7eb3b8c454e9c25731eb2ba9ba45e54fe3f1283 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* rhi: d3d: Fix resource binding mismatch with multiple passesLaszlo Agocs2019-07-012-0/+7
| | | | | | | | | | | | | | The resetShaderResources() done when starting a render or compute pass purges all vertex, index, SRV, and UAV bindings. This will be optimized at a later point, but until then the command buffer's state should be updated accordingly, otherwise certain use cases end up with incorrect rendering results due to not binding vertex/index/shader resources as appropriate. This fixes the shadowmap example on d3d. Change-Id: I4d07929b8664b64bc608c6c8df474b0ee7c2ddbb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Improve base vertex/instance supportLaszlo Agocs2019-07-017-25/+90
| | | | | | | | | Have feature flags as appropriate. OpenGL is causing a mess here but let's support what we can since some of this will become relevant in more sophisticated mesh drawing cases with 3D in particular. Change-Id: Idfa7b4642ec87147978e03d78d6233efbd151491 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: gl: Add support for instanced drawingLaszlo Agocs2019-07-012-16/+45
| | | | | | | ...when having a 3.3+ or ES 3.0+ context. Change-Id: Ie92815263e190912d8f0b7b92ae6da55e062af05 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: gl: Adjust texture and renderbuffer sizes automaticallyLaszlo Agocs2019-07-012-18/+47
| | | | | | | | | | | | | | | | | | | | | Enforce the maximum texture size limit both for textures and renderbuffers, showing warnings and adjusting the size automatically. On the low end ES 2.0 devices we can easily hit a maximum size of 2048x2048. For example a Raspberry Pi running in full HD with the Controls 2 Material style breaks right away as it tries to create slightly wider than 2048 texture for its ShaderEffect. Instead of breaking with an obscure framebuffer incomplete warning at best, show something more informative and adjust the sizes so that something shows up on the screen still. (naturally applications not taking the maximum sizes returned from QRhi into account are technically incorrect and may well end up with incorrect rendering, but we should still try handling this as gracefully as possible) Change-Id: Ib75eb893ab4774e1a3c49ed2d14c6bf9be8c807a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: gl: Make fb attachment logic ES 2.0 and WebGL compatibleLaszlo Agocs2019-07-012-19/+68
| | | | | | | | | | | | So that we can now operate on plain ES 2.0 implementations like the Broadcom stack on the Raspberry Pi (which does not even have packed depth stencil). Also add the WebGL-specific combined attach logic to enable WebAssembly. This has not been tested in practice. Change-Id: I21219319062f295c1e88e3057c0c2ede724ac664 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Enhance line width and point size supportLaszlo Agocs2019-07-017-9/+52
| | | | | | | | | | | | | | | | | | | | | ...but this will vary between backends, or in some cases even between implementations of the same API. Point size is settable only via the vertex shader (gl_PointSize). It is silently ignored with D3D and HLSL. Line widths other than 1 are supported only on OpenGL and Vulkan. (but this is in fact deprecated with GL and optional with Vulkan) Add QRhi::Feature values for both. The line width is now settable on QRhiGraphicsPipeline. It is not a dynamic state since the static, per-pipeline width is good enough for most cases. (and the feature is not supported on half of the backends anyways so it will get limited use in practice). Change-Id: I6d3a32269527c452b794b2cb8b0f03101eab40b2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* RHI: Fix deprecation warnings about QAtomicInteger::load()Friedemann Kleint2019-06-282-5/+5
| | | | | | | | | | | | | | | | | | Replace by loadRelaxed(), fixing: rhi\qrhi.cpp: In static member function 'static QRhiShaderResourceBinding QRhiShaderResourceBinding::uniformBuffer(int, QRhiShaderResourceBinding::StageFlags, QRhiBuffer*)': rhi\qrhi.cpp:2578:26: warning: 'T QBasicAtomicInteger<T>::load() const [with T = int]' is deprecated: Use loadRelaxed [-Wdeprecated-declarations] Q_ASSERT(d->ref.load() == 1); Change-Id: Iebe9a62d20498e67bde34b2f0cab8cc38682154f Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* RHI: Fix compilation with MinGW developer buildsFriedemann Kleint2019-06-281-2/+3
| | | | | | | | | | | | | | | | Make aligned a template, fixing: rhi\qrhid3d11.cpp: In member function 'void QRhiD3D11::updateShaderResourceBindings(QD3D11ShaderResourceBindings*)': rhi\qrhid3d11.cpp:1627:53: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] Q_ASSERT(aligned(b->u.ubuf.offset, 256) == b->u.ubuf.offset); Change-Id: I6b747ebaf78e5accb9b7ed145df71a80d0a15762 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Optimize some atomic countersMarc Mutz2019-06-272-6/+3
| | | | | | | | | | | | Define the static QAtomic at file scope to avoid GCC's pessimisation with function-static QAtomic (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79561), and make sure the initial value is 0, so it ends up in BSS, not TEXT. In QRhi..., don't create a static instance of the wrapper class, use a file- static atomic, too. This turns the class into a glorified namespace. Change-Id: I707f628e2b434330028077223071716d5704ba32 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* rhi: d3d: gl: Remove incorrect exec.Cmd.Buf. assumptionLaszlo Agocs2019-06-212-4/+0
| | | | | | | | | | | | | May very well be called within an active pass when going through beginExternal() (think examples like d3d11underqml) Change-Id: Ie98e72609308f47497d83fbe10c19ad1ae8eade3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: d3d11: Add compute and load/store res supportLaszlo Agocs2019-06-212-80/+450
| | | | | | | | | | | | | Also revise how we reset shader input/outputs at the beginning of a pass. Change-Id: I6d4057f32318ca09b12e16c602bb1033a3ec8e3c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: metal: Reuse drawable after a frame without a presentLaszlo Agocs2019-06-181-2/+7
| | | | | | | | | | | | | | The source of this is likely a "window" grab from Qt Quick. Requesting a new drawable is an error in this case since we do not enqueue a present for the current one. Change-Id: I64bab03ff46743ce1f270b251229be126f9ad9fb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Add compute api and implement for Vulkan and MetalLaszlo Agocs2019-06-1716-421/+1902
| | | | | | | | | | | | | D3D11 and GL (4.3+, ES 3.1+) will come separately at a later time. Change-Id: If30f2f3d062fa27e57e9912674669225b82a7b93 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Make it possible to request making the context current on GLLaszlo Agocs2019-06-1713-0/+49
| | | | | | | | | | | | | | | | | Needed by Qt Quick to handle cases where the application (or other Qt) code contains OpenGL calls, and Qt Quick facilitates this by ensuring the scenegraph's GL context is current. The expectation is that when running with the GL backend of the rhi, all such code remains fully functional. So add a makeCurrent type of call into the QRhi API that is a no-op with anything other than OpenGL. Change-Id: I6f774bf828e31802bdab0c3fef9421cdc0cebe5c Reviewed-by: Lars Knoll <lars.knoll@qt.io>